Codec

Trait Codec 

Source
pub trait Codec: Send + Sync {
    // Required methods
    fn encode<'life0, 'life1, 'async_trait>(
        &'life0 self,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, HeliaError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn decode<'life0, 'life1, 'async_trait>(
        &'life0 self,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, HeliaError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn code(&self) -> u64;
}
Expand description

IPLD codec trait

Required Methods§

Source

fn encode<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Bytes, HeliaError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Encode data using this codec

Source

fn decode<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Bytes, HeliaError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decode data using this codec

Source

fn code(&self) -> u64

Get the codec code

Implementors§