Skip to main content

ParseToStruct

Trait ParseToStruct 

Source
pub trait ParseToStruct:
    FromBytes
    + KnownLayout
    + Immutable
    + Unaligned
    + IntoBytes
    + Sized {
    // Provided methods
    fn from_reader_with_offset(
        reader: &dyn Reader,
        offset: u64,
    ) -> Result<Self, ParsingError> { ... }
    fn to_struct_ref(
        data: &[u8],
        error_type: ParsingError,
    ) -> Result<&Self, ParsingError> { ... }
    fn from_struct_to_writer(
        &self,
        writer: &dyn ReaderWriter,
        offset: u64,
    ) -> Result<(), ParsingError> { ... }
}
Expand description

All functions to help parse data into respective structs.

Provided Methods§

Source

fn from_reader_with_offset( reader: &dyn Reader, offset: u64, ) -> Result<Self, ParsingError>

Source

fn to_struct_ref( data: &[u8], error_type: ParsingError, ) -> Result<&Self, ParsingError>

Casts the &u8 data to &Self.

Self is the ext4 struct that represents the given data.

Source

fn from_struct_to_writer( &self, writer: &dyn ReaderWriter, offset: u64, ) -> Result<(), ParsingError>

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§

Source§

impl<T: FromBytes + KnownLayout + Immutable + Unaligned + IntoBytes> ParseToStruct for T

Apply to all EXT4 structs as seen above.