Trait Encoder

Source
pub trait Encoder<T> {
    type Error;

    // Required method
    fn encode<W: Writer>(
        &mut self,
        item: &T,
        writer: &mut W,
    ) -> Result<(), Self::Error>;

    // Provided methods
    fn size_hint() -> (usize, Option<usize>) { ... }
    fn estimate_size(&self, _: &T) -> usize { ... }
}

Required Associated Types§

Required Methods§

Source

fn encode<W: Writer>( &mut self, item: &T, writer: &mut W, ) -> Result<(), Self::Error>

Provided Methods§

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§