Trait WriteEx

Source
pub trait WriteEx: Send {
    // Required methods
    fn write2<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        buf: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn flush2<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close2<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn write_all2<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        buf: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn write_varint<'life0, 'async_trait>(
        &'life0 mut self,
        len: usize,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn write_fixed_u32<'life0, 'async_trait>(
        &'life0 mut self,
        len: usize,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn write_one_fixed<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        buf: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn write_one<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        buf: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Write Trait for async/await

Required Methods§

Source

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

Attempt to write bytes from buf into the object.

On success, returns Ok(num_bytes_written). Otherwise, returns Err(io:Error)

Source

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

Attempt to flush the object, ensuring that any buffered data reach their destination.

On success, returns Ok(()). Otherwise, returns Err(io:Error)

Source

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

Attempt to close the object.

On success, returns Ok(()). Otherwise, returns Err(io:Error)

Provided Methods§

Source

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

Attempt to write the entire contents of data into object.

The operation will not complete until all the data has been written.

On success, returns Ok(()). Otherwise, returns Err(io:Error)

Source

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

Writes a variable-length integer to the underlying IO.

On success, returns Ok(()). Otherwise, returns Err(io:Error)

Note: Does NOT flush the IO.

Source

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

Writes a fixed-length integer to the underlying IO.

On success, returns Ok(()). Otherwise, returns Err(io:Error)

Note: Does NOT flush the IO.

Source

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

Send a fixed length message to the underlying IO, then flushes the writing side.

Note: Prepends a fixed-length prefix indicate the length of the message. This is compatible with what read_one_fixed expects.

Source

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

Send a variable length message to the underlying IO, then flushes the writing side.

On success, returns Ok(()). Otherwise, returns Err(io:Error)

Note: Prepends a variable-length prefix indicate the length of the message. This is compatible with what read_one expects.

Implementors§