Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder<'a> {
    type In;
    type Encoded: AsRef<[u8]>;
    type Out;

    // Required methods
    fn encode(d: Self::In) -> Self::Encoded;
    fn decode(bytes: &'a [u8]) -> Option<Self::Out>;
}

Required Associated Types§

Required Methods§

Source

fn encode(d: Self::In) -> Self::Encoded

Source

fn decode(bytes: &'a [u8]) -> Option<Self::Out>

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§

Source§

impl<'a> Encoder<'a> for DefaultEncoder

Source§

type In = &'a [u8]

Source§

type Encoded = &'a [u8]

Source§

type Out = &'a [u8]

Source§

impl<'a, T> Encoder<'a> for JSONEncoder<T>
where T: Sized + Serialize + Deserialize<'a> + 'a,