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(
        &self,
        addr: SocketAddr,
    ) -> impl Future<Output = Result<impl AsyncIOHandle + Send>> + Send
       where Self: Sized;
}
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( &self, addr: SocketAddr, ) -> impl Future<Output = Result<impl AsyncIOHandle + Send>> + Send
where Self: Sized,

Create a TcpStream by connecting to a remote host

Implementors§

Source§

impl Reactor for AsyncIO

Source§

impl Reactor for Smol

Source§

impl Reactor for Tokio

Source§

impl<E: Executor + Sync, R: Reactor + Sync> Reactor for RuntimeParts<E, R>

Source§

impl<R: Deref + Sync> Reactor for R
where R::Target: Reactor + Sized,

Source§

impl<RK: RuntimeKit + Sync + 'static> Reactor for Runtime<RK>