Trait ReadConstant

Source
pub trait ReadConstant<const LENGTH: usize>: Sized {
    // Required method
    fn read_constant_bytes_with_callback<F, R: Read>(
        reader: &mut R,
        callback: F,
    ) -> Result<Self>
       where F: Fn(&mut [u8]);

    // Provided method
    fn read_constant_bytes<R: Read>(reader: &mut R) -> Result<Self> { ... }
}
Expand description

This trait is to read a constant-length array.

Required Methods§

Source

fn read_constant_bytes_with_callback<F, R: Read>( reader: &mut R, callback: F, ) -> Result<Self>
where F: Fn(&mut [u8]),

Provided Methods§

Source

fn read_constant_bytes<R: Read>(reader: &mut R) -> Result<Self>

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.

Implementations on Foreign Types§

Source§

impl<const LENGTH: usize> ReadConstant<LENGTH> for String

Source§

fn read_constant_bytes_with_callback<F, R: Read>( reader: &mut R, callback: F, ) -> Result<Self>
where F: Fn(&mut [u8]),

Source§

impl<const LENGTH: usize> ReadConstant<LENGTH> for [u8; LENGTH]

Source§

fn read_constant_bytes_with_callback<F, R: Read>( reader: &mut R, callback: F, ) -> Result<Self>
where F: Fn(&mut [u8]),

Implementors§