Trait Header

Source
pub trait Header {
    // Required methods
    fn parse_bytes(bytes: Vec<u8>, pos: u64) -> Result<Self, PeError>
       where Self: Sized;
    fn is_valid(&self) -> bool;
    fn length() -> usize;

    // Provided method
    fn parse_buf(
        reader: &mut impl BufReadExt,
        pos: u64,
        offset: u64,
    ) -> Result<Self, PeError>
       where Self: Sized { ... }
}

Required Methods§

Source

fn parse_bytes(bytes: Vec<u8>, pos: u64) -> Result<Self, PeError>
where Self: Sized,

Source

fn is_valid(&self) -> bool

Source

fn length() -> usize

Provided Methods§

Source

fn parse_buf( reader: &mut impl BufReadExt, pos: u64, offset: u64, ) -> Result<Self, PeError>
where Self: Sized,

Parse from an instance of BufReadExt. will read Self::length() bytes from offset and will use pos for calculating field offset and rva.

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§