Trait StructFromBytes

Source
pub trait StructFromBytes<T: PackedSize = Self>: PackedSize {
    // Required methods
    fn from_bytes(slice: &[u8], offset: usize) -> Result<Box<Self>>;
    fn from_stream<R>(stream: &mut R) -> Result<Box<Self>>
       where R: Read;
}

Required Methods§

Source

fn from_bytes(slice: &[u8], offset: usize) -> Result<Box<Self>>

Creates an instance of T by parsing a slice of bytes.

This method assumes that the byte slice contains unaligned data.

Source

fn from_stream<R>(stream: &mut R) -> Result<Box<Self>>
where R: Read,

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§