Skip to main content

CoolCodec

Trait CoolCodec 

Source
pub trait CoolCodec:
    Clone
    + Send
    + Sync
    + 'static {
    const CONTENT_TYPE: &'static str;

    // Required methods
    fn encode<T: Serialize + ?Sized>(
        &self,
        value: &T,
    ) -> Result<Vec<u8>, CoolError>;
    fn decode<T: for<'de> Deserialize<'de>>(
        &self,
        bytes: &[u8],
    ) -> Result<T, CoolError>;
}

Required Associated Constants§

Source

const CONTENT_TYPE: &'static str

Required Methods§

Source

fn encode<T: Serialize + ?Sized>(&self, value: &T) -> Result<Vec<u8>, CoolError>

Source

fn decode<T: for<'de> Deserialize<'de>>( &self, bytes: &[u8], ) -> Result<T, CoolError>

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§