Skip to main content

DecodeFixed

Trait DecodeFixed 

Source
pub trait DecodeFixed: Read<Cfg = ()> + FixedSize {
    // Provided method
    fn decode_fixed<const N: usize>(bytes: [u8; N]) -> Result<Self, Error> { ... }
}
Expand description

Convenience trait for FixedSize types that can be decoded directly from a fixed-size array.

Provided Methods§

Source

fn decode_fixed<const N: usize>(bytes: [u8; N]) -> Result<Self, Error>

Decodes a value from a fixed-size byte array [u8; N], ensuring all bytes are consumed.

§Panics

Panics if N is not equal to <Self as FixedSize>::SIZE.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T: Read<Cfg = ()> + FixedSize> DecodeFixed for T