Trait DataEncoder

Source
pub trait DataEncoder:
    Serialize
    + DeserializeOwned
    + Clone
    + Send
    + Sync
    + Debug
    + Sized {
    type Err: Error + From<DataParserError>;

    // Provided methods
    fn data_parser() -> DataParser { ... }
    fn encode<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn encode_json(&self) -> Result<Vec<u8>, Self::Err> { ... }
    fn decode<'life0, 'async_trait>(
        encoded: &'life0 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn decode_json(encoded: &[u8]) -> Result<Self, Self::Err> { ... }
    fn to_json_value(&self) -> Result<Value, Self::Err> { ... }
}

Required Associated Types§

Provided Methods§

Source

fn data_parser() -> DataParser

Source

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

Source

fn encode_json(&self) -> Result<Vec<u8>, Self::Err>

Source

fn decode<'life0, 'async_trait>( encoded: &'life0 [u8], ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn decode_json(encoded: &[u8]) -> Result<Self, Self::Err>

Source

fn to_json_value(&self) -> Result<Value, Self::Err>

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§