Trait AsyncInlinableRead

Source
pub trait AsyncInlinableRead:
    AsyncRead
    + Unpin
    + Send {
    // Provided methods
    fn read_len_with_width<'life0, 'async_trait, const N: usize>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn read_len_with_data<'life0, 'async_trait, const N: usize>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn read_inlined_bytes<'life0, 'async_trait, const N: usize>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn read_inlined_str<'life0, 'async_trait, const N: usize>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn read_inlinable<'life0, 'async_trait, T>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
       where T: Sized + 'async_trait + AsyncInlinable,
             Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Provided Methods§

Source

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

Read N bytes as usize.

Only 1/2/4/8 is valid as N.

Source

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

Read a bytes len with width N and the next len - N bytes into a Vec

The bytes contains:

+--------------+-----------------+
| len: N bytes | data: len - N bytes |
+--------------+-----------------+
Source

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

Read inlined bytes with specific length width N.

The inlined bytes are constructed as:

+--------------+-----------------+
| len: N bytes | data: len bytes |
+--------------+-----------------+
Source

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

Read inlined string with specific length width N.

The inlined string are constructed as:

+--------------+-----------------+
| len: N bytes | data: len bytes |
+--------------+-----------------+
Source

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

Read some bytes into inlinable object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> AsyncInlinableRead for T
where T: AsyncRead + Send + Unpin,