Skip to main content

TypeCodec

Trait TypeCodec 

Source
pub trait TypeCodec {
    // Required methods
    fn encode(&self, writer: &mut impl Write) -> Result<(), CodecError>;
    fn decode(reader: &mut impl Read) -> Result<Self, CodecError>
       where Self: Sized;
}
Expand description

Encodes and decodes a value with a context-independent wire representation.

Required Methods§

Source

fn encode(&self, writer: &mut impl Write) -> Result<(), CodecError>

Encodes this value to the writer.

Source

fn decode(reader: &mut impl Read) -> Result<Self, CodecError>
where Self: Sized,

Decodes this value from the reader.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§