Skip to main content

Decode

Trait Decode 

Source
pub trait Decode: Sized {
    // Required method
    fn decode<D>(decoder: &mut D) -> Result<Self, Error>
       where D: Decoder;

    // Provided methods
    fn decode_v1(data: &[u8]) -> Result<Self, Error> { ... }
    fn decode_v2(data: &[u8]) -> Result<Self, Error> { ... }
}
Expand description

A trait that can be implemented by any other type in order to support lib0 decoding capability.

Required Methods§

Source

fn decode<D>(decoder: &mut D) -> Result<Self, Error>
where D: Decoder,

Provided Methods§

Source

fn decode_v1(data: &[u8]) -> Result<Self, Error>

Helper function for decoding 1st version of lib0 encoding.

Source

fn decode_v2(data: &[u8]) -> Result<Self, Error>

Helper function for decoding 2nd version of lib0 encoding.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Decode for Range<u32>

Source§

fn decode<D>(decoder: &mut D) -> Result<Range<u32>, Error>
where D: Decoder,

Implementors§