Trait Transport

Source
pub trait Transport:
    Reconnectable
    + Debug
    + Send
    + Sync {
    // Required methods
    fn try_read(&self, buf: &mut [u8]) -> Result<usize>;
    fn try_write(&self, buf: &[u8]) -> Result<usize>;
    fn ready<'life0, 'async_trait>(
        &'life0 self,
        interest: Interest,
    ) -> Pin<Box<dyn Future<Output = Result<Ready>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Interface representing a transport of raw bytes into and out of the system.

Required Methods§

Source

fn try_read(&self, buf: &mut [u8]) -> Result<usize>

Tries to read data from the transport into the provided buffer, returning how many bytes were read.

This call may return an error with ErrorKind::WouldBlock in the case that the transport is not ready to read data.

Source

fn try_write(&self, buf: &[u8]) -> Result<usize>

Try to write a buffer to the transport, returning how many bytes were written.

This call may return an error with ErrorKind::WouldBlock in the case that the transport is not ready to write data.

Source

fn ready<'life0, 'async_trait>( &'life0 self, interest: Interest, ) -> Pin<Box<dyn Future<Output = Result<Ready>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Waits for the transport to be ready based on the given interest, returning the ready status.

Trait Implementations§

Source§

impl Reconnectable for Box<dyn Transport>

Source§

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

Attempts to reconnect an already-established connection.
Source§

impl Transport for Box<dyn Transport>

Source§

fn try_read(&self, buf: &mut [u8]) -> Result<usize>

Tries to read data from the transport into the provided buffer, returning how many bytes were read. Read more
Source§

fn try_write(&self, buf: &[u8]) -> Result<usize>

Try to write a buffer to the transport, returning how many bytes were written. Read more
Source§

fn ready<'life0, 'async_trait>( &'life0 self, interest: Interest, ) -> Pin<Box<dyn Future<Output = Result<Ready>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Waits for the transport to be ready based on the given interest, returning the ready status.

Implementations on Foreign Types§

Source§

impl Transport for Box<dyn Transport>

Source§

fn try_read(&self, buf: &mut [u8]) -> Result<usize>

Source§

fn try_write(&self, buf: &[u8]) -> Result<usize>

Source§

fn ready<'life0, 'async_trait>( &'life0 self, interest: Interest, ) -> Pin<Box<dyn Future<Output = Result<Ready>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§