EncodeFixed

Trait EncodeFixed 

Source
pub trait EncodeFixed: Write + FixedSize {
    // Provided method
    fn encode_fixed<const N: usize>(&self) -> [u8; N] { ... }
}
Expand description

Convenience trait for FixedSize types that can be encoded directly into a fixed-size array.

Provided Methods§

Source

fn encode_fixed<const N: usize>(&self) -> [u8; N]

Encodes self into a fixed-size byte array [u8; N].

§Panics

Panics if N is not equal to <Self as FixedSize>::SIZE. Also panics if the write() implementation does not write exactly N bytes.

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§