Trait object::read::macho::Segment

source ·
pub trait Segment: Debug + Pod {
    type Word: Into<u64>;
    type Endian: Endian;
    type Section: Section<Endian = Self::Endian>;

Show 16 methods // Required methods fn from_command( command: LoadCommandData<'_, Self::Endian>, ) -> Result<Option<(&Self, &[u8])>>; 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; // Provided methods fn name(&self) -> &[u8] { ... } 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 sections<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, section_data: R, ) -> Result<&'data [Self::Section]> { ... }
}
Expand description

A trait for generic access to SegmentCommand32 and SegmentCommand64.

Required Associated Types§

Required Methods§

source

fn from_command( command: LoadCommandData<'_, Self::Endian>, ) -> Result<Option<(&Self, &[u8])>>

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

Provided Methods§

source

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

Return the segname bytes up until the null terminator.

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], ()>

Get the segment data from the file data.

Returns Err for invalid values.

source

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

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

Returns Err for invalid values.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Endian: Endian> Segment for SegmentCommand32<Endian>

§

type Word = u32

§

type Endian = Endian

§

type Section = Section32<<SegmentCommand32<Endian> as Segment>::Endian>

source§

impl<Endian: Endian> Segment for SegmentCommand64<Endian>

§

type Word = u64

§

type Endian = Endian

§

type Section = Section64<<SegmentCommand64<Endian> as Segment>::Endian>