Trait Decode

Source
pub trait Decode<'de>: Sized {
    // Required method
    fn decode(src: &mut ReadCursor<'de>) -> DecodeResult<Self>;
}
Expand description

Trait for types that can be decoded from a byte stream.

This trait is implemented by types that can be deserialized from a sequence of bytes.

Required Methods§

Source

fn decode(src: &mut ReadCursor<'de>) -> DecodeResult<Self>

Decodes an instance of Self from the given byte stream.

§Arguments
  • src - A mutable reference to a ReadCursor containing the bytes to decode.
§Returns

Returns a DecodeResult<Self>, which is either the successfully decoded instance or a DecodeError if decoding fails.

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§