[][src]Trait object::read::macho::Segment

pub trait Segment: Debug + Pod {
    type Word: Into<u64>;
    type Endian: Endian;
    type Section: Section<Endian = Self::Endian>;
    fn from_command(
        command: MachOLoadCommand<Self::Endian>
    ) -> Result<Option<(&Self, Bytes)>>;
fn cmd(&self, endian: Self::Endian) -> u32;
fn cmdsize(&self, endian: Self::Endian) -> u32;
fn segname(&self) -> &[u8; 16];
fn vmaddr(&self, endian: Self::Endian) -> Self::Word;
fn vmsize(&self, endian: Self::Endian) -> Self::Word;
fn fileoff(&self, endian: Self::Endian) -> Self::Word;
fn filesize(&self, endian: Self::Endian) -> Self::Word;
fn maxprot(&self, endian: Self::Endian) -> u32;
fn initprot(&self, endian: Self::Endian) -> u32;
fn nsects(&self, endian: Self::Endian) -> u32;
fn flags(&self, endian: Self::Endian) -> u32; fn name(&self) -> &[u8] { ... }
fn file_range(&self, endian: Self::Endian) -> (u64, u64) { ... }
fn data<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<Bytes<'data>, ()> { ... }
fn sections<'data>(
        &self,
        endian: Self::Endian,
        data: Bytes<'data>
    ) -> Result<&'data [Self::Section]> { ... } }

A trait for generic access to SegmentCommand32 and SegmentCommand64.

Associated Types

type Word: Into<u64>

type Endian: Endian

type Section: Section<Endian = Self::Endian>

Loading content...

Required methods

fn from_command(
    command: MachOLoadCommand<Self::Endian>
) -> Result<Option<(&Self, Bytes)>>

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

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

fn segname(&self) -> &[u8; 16]

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

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

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

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

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

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

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

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

Loading content...

Provided methods

fn name(&self) -> &[u8]

Return the segname bytes up until the null terminator.

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

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

fn data<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<Bytes<'data>, ()>

Get the segment data from the file data.

Returns Err for invalid values.

fn sections<'data>(
    &self,
    endian: Self::Endian,
    data: Bytes<'data>
) -> Result<&'data [Self::Section]>

Get the array of sections from the data following the segment command.

Returns Err for invalid values.

Loading content...

Implementors

impl<Endian: Endian> Segment for SegmentCommand32<Endian>[src]

type Word = u32

type Endian = Endian

type Section = Section32<Self::Endian>

impl<Endian: Endian> Segment for SegmentCommand64<Endian>[src]

type Word = u64

type Endian = Endian

type Section = Section64<Self::Endian>

Loading content...