Trait FromBytesWithInput

Source
pub trait FromBytesWithInput: Sized + Debug {
    type Input: Debug;

    // Required method
    fn from_bytes_with_input(
        buffer: &mut Cursor<impl AsRef<[u8]>>,
        input: Self::Input,
    ) -> Result<Self, DeError>;

    // Provided method
    fn strip(buffer: &mut Cursor<impl AsRef<[u8]>>) -> Result<(), DeError> { ... }
}
Expand description

Takes an arbitrary input which serves as additional information for guiding the conversion from a byte buffer to a data structure. A common workflow is a data structure that has a size to determine how much more of the data in the byte buffer is part of a given data structure.

Required Associated Types§

Source

type Input: Debug

The type of the additional input.

Required Methods§

Source

fn from_bytes_with_input( buffer: &mut Cursor<impl AsRef<[u8]>>, input: Self::Input, ) -> Result<Self, DeError>

Takes a byte buffer and an additional input and returns the deserialized data structure.

Provided Methods§

Source

fn strip(buffer: &mut Cursor<impl AsRef<[u8]>>) -> Result<(), DeError>

Strip padding from a netlink message.

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 FromBytesWithInput for ()

Source§

type Input = usize

Source§

fn from_bytes_with_input( _: &mut Cursor<impl AsRef<[u8]>>, input: usize, ) -> Result<Self, DeError>

Source§

impl FromBytesWithInput for String

Source§

type Input = usize

Source§

fn from_bytes_with_input( buffer: &mut Cursor<impl AsRef<[u8]>>, input: usize, ) -> Result<Self, DeError>

Source§

impl<T> FromBytesWithInput for Vec<T>
where T: FromBytes,

Source§

type Input = usize

Source§

fn from_bytes_with_input( buffer: &mut Cursor<impl AsRef<[u8]>>, input: Self::Input, ) -> Result<Self, DeError>

Implementors§