[][src]Struct elfy::Elf

pub struct Elf { /* fields omitted */ }

Represents a parsed ELF (Executable and Linkable Format) file.

The ELF format is a common standard file format for executable files, object code, shared libraries, and core dumps.

Methods

impl Elf[src]

pub fn load<P: AsRef<Path>>(path: P) -> ParseElfResult<Elf>[src]

Loads an ELF file from disk and parses it

Errors

Returns 'Err' if the file can not be loaded or if parsing fails, with a description of the failure

Examples

let elf = Elf::load("examples/example-binary").unwrap();

pub fn parse<R: Read + Seek>(reader: &mut R) -> ParseElfResult<Elf>[src]

Parses an ELF file from a reader source

'reader' can be anything that implements both 'Read' and 'Seek'

Errors

Returns 'Err' if parsing fails, with a description of what caused the failure

Examples

let mut buf = std::io::BufReader::new(file);
let elf = Elf::parse(&mut buf).unwrap();

pub fn try_get_section(&self, section_name: &str) -> Option<&Section>[src]

Tries to retrieve a section by name, returns 'None' if the section does not exist

Examples

 
let elf = Elf::load("examples/example-binary").unwrap();
let text = elf.try_get_section(".text").unwrap();
 
assert_eq!(SectionFlags::AllocExecute, text.header().flags);

Trait Implementations

impl Debug for Elf[src]

Auto Trait Implementations

impl Send for Elf

impl Sync for Elf

impl Unpin for Elf

impl UnwindSafe for Elf

impl RefUnwindSafe for Elf

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]