1use std::{io, ops::Deref, time::Duration};
2
3use compio_runtime::Runtime;
4use mod_use::mod_use;
5
6cfg_if::cfg_if! {
7 if #[cfg(windows)] {
8 mod_use![windows];
9 } else if #[cfg(unix)] {
10 mod_use![unix];
11 } else {
12 compile_error!("Unsupported platform");
13 }
14}
15
16#[allow(async_fn_in_trait)]
18pub trait Adapter: Sized + Deref<Target = Runtime> {
19 fn new(runtime: Runtime) -> io::Result<Self>;
21
22 async fn wait(&self, timeout: Option<Duration>) -> io::Result<()>;
24
25 fn clear(&self) -> io::Result<()>;
27}