use std::{
io::{Result, SeekFrom},
task::{Poll, Waker},
time::Duration,
};
pub trait Reactor {
fn poll_once(&mut self, duration: Duration) -> Result<usize>;
}
pub trait ReactorHandleSeekable {
fn seek(&mut self, pos: SeekFrom, waker: Waker, timeout: Option<Duration>)
-> Poll<Result<u64>>;
}
pub trait ReactorHandle: Sized {
type WriteBuffer<'cx>: Unpin
where
Self: 'cx;
type ReadBuffer<'cx>: Unpin
where
Self: 'cx;
fn poll_write<'cx>(
self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buffer: Self::WriteBuffer<'cx>,
timeout: Option<Duration>,
) -> Poll<Result<usize>>;
fn poll_read<'cx>(
self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
buffer: Self::ReadBuffer<'cx>,
timeout: Option<Duration>,
) -> Poll<Result<usize>>;
fn poll_close(
self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> Poll<Result<()>>;
}