Trait Encode

Source
pub trait Encode<E: Encoder>
where Self: Sized,
{ // Required method fn encode_data(&self, encoder: &mut E) -> Result<(), E::Error>; }
Expand description

The Encode trait is used to encode versioned data.

Many Encoders will provide a blanket implementation for this trait.

Required Methods§

Source

fn encode_data(&self, encoder: &mut E) -> Result<(), E::Error>

Encodes the data to the encoder.

§Errors

This function will return an error if encoder fails to encode the data.

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<W, T> Encode<Encoder<W>> for T
where T: Encode, W: Write,