Trait object::read::elf::ProgramHeader

source ·
pub trait ProgramHeader: Debug + Pod {
    type Elf: FileHeader<ProgramHeader = Self, Endian = Self::Endian, Word = Self::Word>;
    type Word: Into<u64>;
    type Endian: Endian;

Show 14 methods // Required methods fn p_type(&self, endian: Self::Endian) -> u32; fn p_flags(&self, endian: Self::Endian) -> u32; fn p_offset(&self, endian: Self::Endian) -> Self::Word; fn p_vaddr(&self, endian: Self::Endian) -> Self::Word; fn p_paddr(&self, endian: Self::Endian) -> Self::Word; fn p_filesz(&self, endian: Self::Endian) -> Self::Word; fn p_memsz(&self, endian: Self::Endian) -> Self::Word; fn p_align(&self, endian: Self::Endian) -> Self::Word; // Provided methods fn file_range(&self, endian: Self::Endian) -> (u64, u64) { ... } fn data<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [u8], ()> { ... } fn data_as_array<'data, T: Pod, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [T], ()> { ... } fn data_range<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, address: u64, size: u64, ) -> Result<Option<&'data [u8]>, ()> { ... } fn dynamic<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<Option<&'data [<Self::Elf as FileHeader>::Dyn]>> { ... } fn notes<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<Option<NoteIterator<'data, Self::Elf>>> { ... }
}
Expand description

A trait for generic access to ProgramHeader32 and ProgramHeader64.

Required Associated Types§

source

type Elf: FileHeader<ProgramHeader = Self, Endian = Self::Endian, Word = Self::Word>

source

type Word: Into<u64>

source

type Endian: Endian

Required Methods§

source

fn p_type(&self, endian: Self::Endian) -> u32

source

fn p_flags(&self, endian: Self::Endian) -> u32

source

fn p_offset(&self, endian: Self::Endian) -> Self::Word

source

fn p_vaddr(&self, endian: Self::Endian) -> Self::Word

source

fn p_paddr(&self, endian: Self::Endian) -> Self::Word

source

fn p_filesz(&self, endian: Self::Endian) -> Self::Word

source

fn p_memsz(&self, endian: Self::Endian) -> Self::Word

source

fn p_align(&self, endian: Self::Endian) -> Self::Word

Provided Methods§

source

fn file_range(&self, endian: Self::Endian) -> (u64, u64)

Return the offset and size of the segment in the file.

source

fn data<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [u8], ()>

Return the segment data.

Returns Err for invalid values.

source

fn data_as_array<'data, T: Pod, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<&'data [T], ()>

Return the segment data as a slice of the given type.

Allows padding at the end of the data. Returns Ok(&[]) if the segment has no data. Returns Err for invalid values, including bad alignment.

source

fn data_range<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, address: u64, size: u64, ) -> Result<Option<&'data [u8]>, ()>

Return the segment data in the given virtual address range

Returns Ok(None) if the segment does not contain the address. Returns Err for invalid values.

source

fn dynamic<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<Option<&'data [<Self::Elf as FileHeader>::Dyn]>>

Return entries in a dynamic segment.

Returns Ok(None) if the segment is not PT_DYNAMIC. Returns Err for invalid values.

source

fn notes<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, ) -> Result<Option<NoteIterator<'data, Self::Elf>>>

Return a note iterator for the segment data.

Returns Ok(None) if the segment does not contain notes. Returns Err for invalid values.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Endian: Endian> ProgramHeader for ProgramHeader32<Endian>

§

type Word = u32

§

type Endian = Endian

§

type Elf = FileHeader32<Endian>

source§

impl<Endian: Endian> ProgramHeader for ProgramHeader64<Endian>

§

type Word = u64

§

type Endian = Endian

§

type Elf = FileHeader64<Endian>