Trait object::read::ObjectSegment[][src]

pub trait ObjectSegment<'data>: Sealed {
    fn address(&self) -> u64;
fn size(&self) -> u64;
fn align(&self) -> u64;
fn file_range(&self) -> (u64, u64);
fn data(&self) -> Result<&'data [u8]>;
fn data_range(&self, address: u64, size: u64) -> Result<Option<&'data [u8]>>;
fn name(&self) -> Result<Option<&str>>; }

A loadable segment defined in an object file.

For ELF, this is a program header with type PT_LOAD. For Mach-O, this is a load command with type LC_SEGMENT or LC_SEGMENT_64.

Required methods

fn address(&self) -> u64[src]

Returns the virtual address of the segment.

fn size(&self) -> u64[src]

Returns the size of the segment in memory.

fn align(&self) -> u64[src]

Returns the alignment of the segment in memory.

fn file_range(&self) -> (u64, u64)[src]

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

fn data(&self) -> Result<&'data [u8]>[src]

Returns a reference to the file contents of the segment.

The length of this data may be different from the size of the segment in memory.

fn data_range(&self, address: u64, size: u64) -> Result<Option<&'data [u8]>>[src]

Return the segment data in the given range.

Returns Ok(None) if the segment does not contain the given range.

fn name(&self) -> Result<Option<&str>>[src]

Returns the name of the segment.

Loading content...

Implementors

impl<'data, 'file, Elf, R> ObjectSegment<'data> for ElfSegment<'data, 'file, Elf, R> where
    Elf: FileHeader,
    R: ReadRef<'data>, 
[src]

impl<'data, 'file, Mach, R> ObjectSegment<'data> for MachOSegment<'data, 'file, Mach, R> where
    Mach: MachHeader,
    R: ReadRef<'data>, 
[src]

impl<'data, 'file, Pe, R> ObjectSegment<'data> for PeSegment<'data, 'file, Pe, R> where
    Pe: ImageNtHeaders,
    R: ReadRef<'data>, 
[src]

impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for CoffSegment<'data, 'file, R>[src]

impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for Segment<'data, 'file, R>[src]

Loading content...