#[cfg(unix)]
mod unix;
#[cfg(windows)]
mod windows;
use std::{io, time::Duration};
#[cfg(unix)]
pub use unix::*;
#[cfg(windows)]
pub use windows::*;
use crate::{Event, EventReader, WindowSize};
#[cfg(unix)]
pub type PlatformTerminal = UnixTerminal;
#[cfg(windows)]
pub type PlatformTerminal = WindowsTerminal;
#[cfg(unix)]
pub type PlatformHandle = FileDescriptor;
#[cfg(windows)]
pub type PlatformHandle = OutputHandle;
pub trait Terminal: io::Write {
fn enter_raw_mode(&mut self) -> io::Result<()>;
fn enter_cooked_mode(&mut self) -> io::Result<()>;
fn get_dimensions(&self) -> io::Result<WindowSize>;
fn event_reader(&self) -> EventReader;
fn poll<F: Fn(&Event) -> bool>(&self, filter: F, timeout: Option<Duration>)
-> io::Result<bool>;
fn read<F: Fn(&Event) -> bool>(&self, filter: F) -> io::Result<Event>;
fn set_panic_hook(&mut self, f: impl Fn(&mut PlatformHandle) + Send + Sync + 'static);
}