Trait TransportExt

Source
pub trait TransportExt {
    // Required methods
    fn readable<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn writeable<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn readable_or_writeable<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_exact<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 mut [u8],
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_to_end<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 mut Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_to_string<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 mut String,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn write_all<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

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

Waits for the transport to be readable to follow up with try_read.

Source

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

Waits for the transport to be writeable to follow up with try_write.

Source

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

Waits for the transport to be either readable or writeable.

Source

fn read_exact<'life0, 'life1, 'async_trait>( &'life0 self, buf: &'life1 mut [u8], ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads exactly n bytes where n is the length of buf by continuing to call try_read until completed. Calls to readable are made to ensure the transport is ready. Returns the total bytes read.

Source

fn read_to_end<'life0, 'life1, 'async_trait>( &'life0 self, buf: &'life1 mut Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reads all bytes until EOF in this source, placing them into buf.

All bytes read from this source will be appended to the specified buffer buf. This function will continuously call try_read to append more data to buf until try_read returns either Ok(0) or an error that is neither [Interrupted] or [WouldBlock].

If successful, this function will return the total number of bytes read.

§Errors

If this function encounters an error of the kind [Interrupted] or [WouldBlock], then the error is ignored and the operation will continue.

If any other read error is encountered then this function immediately returns. Any bytes which have already been read will be appended to buf.

Source

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

Reads all bytes until EOF in this source, placing them into buf.

If successful, this function will return the total number of bytes read.

§Errors

If the data in this stream is not valid UTF-8 then an error is returned and buf is unchanged.

See read_to_end for other error semantics.

Source

fn write_all<'life0, 'life1, 'async_trait>( &'life0 self, buf: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Writes all of buf by continuing to call try_write until completed. Calls to [writeable] are made to ensure the transport is ready.

Implementors§