Trait FixedSizeDecodable

Source
pub trait FixedSizeDecodable: Sized {
    type Error;

    const WRONG_SIZE_ERROR: Self::Error;
    const BYTE_SIZE: usize;

    // Required method
    fn decode_checked(buf: &[u8]) -> Result<Self, Self::Error>;
}
Expand description

A decodable type that has an exact size in bytes.

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn decode_checked(buf: &[u8]) -> Result<Self, Self::Error>

Decodes the value. This function assumes that buf is of at least BYTE_SIZE, and assumes that BYTE_SIZE bytes are consumed to decode.

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§