SEncode

Trait SEncode 

Source
pub trait SEncode {
    // Required method
    fn encode<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        s: &'life1 mut T,
    ) -> Pin<Box<dyn Future<Output = Result<(), SError>> + Send + 'async_trait>>
       where T: 'async_trait + AsyncWrite + Unpin + Send,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

SEncode is a asyc trait for encoding. It can be automatically derived for struct by the SEncode macro as long as fields are SEncode. For enum, the macro will encode discriminant as u8/u16… defined by #[repr(*)] before encoding the content. So the enum can be decoded by first reading a u8/u16…
and then decoding the content based on the value of disriminant. For enum, at most one field is supported. named field is not supported for enum for SDecode macro. #[repr(*)] is required for enum to specify the type of discriminant.

Required Methods§

Source

fn encode<'life0, 'life1, 'async_trait, T>( &'life0 self, s: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), SError>> + Send + 'async_trait>>
where T: 'async_trait + AsyncWrite + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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.

Implementations on Foreign Types§

Source§

impl SEncode for u8

Source§

fn encode<'life0, 'life1, 'async_trait, T>( &'life0 self, s: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), SError>> + Send + 'async_trait>>
where T: 'async_trait + AsyncWrite + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl SEncode for u16

Source§

fn encode<'life0, 'life1, 'async_trait, T>( &'life0 self, s: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), SError>> + Send + 'async_trait>>
where T: 'async_trait + AsyncWrite + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<S: SEncode + Send + Sync> SEncode for Arc<S>

Source§

fn encode<'life0, 'life1, 'async_trait, T>( &'life0 self, s: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), SError>> + Send + 'async_trait>>
where T: 'async_trait + AsyncWrite + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<const N: usize> SEncode for [u8; N]

Source§

fn encode<'life0, 'life1, 'async_trait, T>( &'life0 self, s: &'life1 mut T, ) -> Pin<Box<dyn Future<Output = Result<(), SError>> + Send + 'async_trait>>
where T: 'async_trait + AsyncWrite + Unpin + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§