Trait ElfFormat

Source
pub trait ElfFormat {
    // Required methods
    fn header(&self) -> &dyn ElfHeader;
    fn segments(&self) -> Vec<&dyn ElfSegment>;
    fn sections(&self) -> Vec<&dyn ElfSection>;

    // Provided method
    fn section(&self, name: &str) -> Option<&dyn ElfSection> { ... }
}
Expand description

A trait representing the supported methods for a parsed ELF format. This is used as universal interface for Elf file format, some methods are useful when using those ignoring the 32 or 64 part. The information provided by ELF header can be extracted from the ElfHeader trait object which can be gained from header() method.

Required Methods§

Source

fn header(&self) -> &dyn ElfHeader

Get trait object of header

Source

fn segments(&self) -> Vec<&dyn ElfSegment>

all segments trait objects

Source

fn sections(&self) -> Vec<&dyn ElfSection>

all sections trait objects

Provided Methods§

Source

fn section(&self, name: &str) -> Option<&dyn ElfSection>

get some specific section with a given name

Trait Implementations§

Source§

impl<'a> TryFrom<&'a Executable<'a>> for &'a dyn ElfFormat

Source§

fn try_from(value: &'a Executable<'_>) -> Result<&'a dyn ElfFormat, Error>

Tries to convert an Executable reference to an ElfFormat trait object

Source§

type Error = Error

The type returned in the event of a conversion error.

Implementors§

Source§

impl<'a> ElfFormat for Elf32<'a>

Source§

impl<'a> ElfFormat for Elf64<'a>