Trait Host

Source
pub trait Host: Send {
    // Required methods
    fn select<'life0, 'async_trait>(
        &'life0 mut self,
        hs: Vec<Handle>,
        timeout_ms: u32,
    ) -> Pin<Box<dyn Future<Output = Result<Option<u32>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_ready<'life0, 'async_trait>(
        &'life0 mut self,
        handle: Handle,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn select<'life0, 'async_trait>( &'life0 mut self, hs: Vec<Handle>, timeout_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<Option<u32>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Blocks until one of the given objects is ready for I/O, or the optional timeout expires.

Valid object handles includes bodies and pending requests. See the async_item_handle definition for more details, including what I/O actions are associated with each handle type.

The timeout is specified in milliseconds, or 0 if no timeout is desired.

Returns the index (not handle!) of the first object that is ready, or none if the timeout expires before any objects are ready for I/O.

Source

fn is_ready<'life0, 'async_trait>( &'life0 mut self, handle: Handle, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns 1 if the given async item is “ready” for its associated I/O action, 0 otherwise.

If an object is ready, the I/O action is guaranteed to complete without blocking.

Valid object handles includes bodies and pending requests. See the async_item_handle definition for more details, including what I/O actions are associated with each handle type.

Implementations on Foreign Types§

Source§

impl<_T: Host + ?Sized + Send> Host for &mut _T

Source§

fn select<'life0, 'async_trait>( &'life0 mut self, hs: Vec<Handle>, timeout_ms: u32, ) -> Pin<Box<dyn Future<Output = Result<Option<u32>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Blocks until one of the given objects is ready for I/O, or the optional timeout expires.

Valid object handles includes bodies and pending requests. See the async_item_handle definition for more details, including what I/O actions are associated with each handle type.

The timeout is specified in milliseconds, or 0 if no timeout is desired.

Returns the index (not handle!) of the first object that is ready, or none if the timeout expires before any objects are ready for I/O.

Source§

fn is_ready<'life0, 'async_trait>( &'life0 mut self, handle: Handle, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns 1 if the given async item is “ready” for its associated I/O action, 0 otherwise.

If an object is ready, the I/O action is guaranteed to complete without blocking.

Valid object handles includes bodies and pending requests. See the async_item_handle definition for more details, including what I/O actions are associated with each handle type.

Implementors§