Trait AsyncInlinable

Source
pub trait AsyncInlinable {
    // Required methods
    fn read_inlined<'life0, 'async_trait, R>(
        reader: &'life0 mut R,
    ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
       where Self: Sized + 'async_trait,
             R: 'async_trait + AsyncRead + Send + Unpin,
             'life0: 'async_trait;
    fn write_inlined<'life0, 'life1, 'async_trait, W>(
        &'life0 self,
        wtr: &'life1 mut W,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where W: 'async_trait + AsyncWrite + Send + Unpin,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn read_optional_inlined<'life0, 'async_trait, R>(
        reader: &'life0 mut R,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self>>> + Send + 'async_trait>>
       where Self: Sized + Send + 'async_trait,
             R: 'async_trait + AsyncRead + Send + Unpin,
             'life0: 'async_trait { ... }
    fn write_inlined_with<'life0, 'life1, 'async_trait, W>(
        &'life0 self,
        wtr: &'life1 mut W,
        _opts: InlineOpts,
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where W: 'async_trait + AsyncWrite + Send + Unpin,
             Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn inlined<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
    fn printable_inlined<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

If one struct could be serialized/flattened to bytes array, we call it inlinable.

Required Methods§

Source

fn read_inlined<'life0, 'async_trait, R>( reader: &'life0 mut R, ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: Sized + 'async_trait, R: 'async_trait + AsyncRead + Send + Unpin, 'life0: 'async_trait,

Read inlined bytes into object.

Source

fn write_inlined<'life0, 'life1, 'async_trait, W>( &'life0 self, wtr: &'life1 mut W, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where W: 'async_trait + AsyncWrite + Send + Unpin, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write inlined bytes to a writer.

Provided Methods§

Source

fn read_optional_inlined<'life0, 'async_trait, R>( reader: &'life0 mut R, ) -> Pin<Box<dyn Future<Output = Result<Option<Self>>> + Send + 'async_trait>>
where Self: Sized + Send + 'async_trait, R: 'async_trait + AsyncRead + Send + Unpin, 'life0: 'async_trait,

Source

fn write_inlined_with<'life0, 'life1, 'async_trait, W>( &'life0 self, wtr: &'life1 mut W, _opts: InlineOpts, ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where W: 'async_trait + AsyncWrite + Send + Unpin, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write inlined bytes with specific options

Source

fn inlined<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Get inlined bytes as vector.

Source

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

Get inlined bytes as printable string, all the bytes will displayed with escaped ascii code.

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§