Trait Reactor

Source
pub trait Reactor {
    // Required methods
    fn register<H: IO + Send + 'static>(
        &self,
        socket: IOHandle<H>,
    ) -> Result<impl AsyncIOHandle + Send>
       where Self: Sized;
    fn sleep(&self, dur: Duration) -> impl Future<Output = ()>
       where Self: Sized;
    fn interval(&self, dur: Duration) -> impl Stream<Item = Instant>
       where Self: Sized;
    fn tcp_connect<'life0, 'async_trait>(
        &'life0 self,
        addr: SocketAddr,
    ) -> Pin<Box<dyn Future<Output = Result<impl AsyncIOHandle + Send>> + Send + 'async_trait>>
       where Self: Sized + 'async_trait,
             'life0: 'async_trait;
}
Expand description

A common interface for performing actions on a reactor

Required Methods§

Source

fn register<H: IO + Send + 'static>( &self, socket: IOHandle<H>, ) -> Result<impl AsyncIOHandle + Send>
where Self: Sized,

Register a synchronous handle, returning an asynchronous one

Source

fn sleep(&self, dur: Duration) -> impl Future<Output = ()>
where Self: Sized,

Sleep for the given duration

Source

fn interval(&self, dur: Duration) -> impl Stream<Item = Instant>
where Self: Sized,

Stream that yields at every given interval

Source

fn tcp_connect<'life0, 'async_trait>( &'life0 self, addr: SocketAddr, ) -> Pin<Box<dyn Future<Output = Result<impl AsyncIOHandle + Send>> + Send + 'async_trait>>
where Self: Sized + 'async_trait, 'life0: 'async_trait,

Create a TcpStream by connecting to a remote host

Implementors§