object::read::macho

Trait MachHeader

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

Show 15 methods // Required methods fn is_type_64(&self) -> bool; fn is_big_endian(&self) -> bool; fn is_little_endian(&self) -> bool; fn magic(&self) -> u32; fn cputype(&self, endian: Self::Endian) -> u32; fn cpusubtype(&self, endian: Self::Endian) -> u32; fn filetype(&self, endian: Self::Endian) -> u32; fn ncmds(&self, endian: Self::Endian) -> u32; fn sizeofcmds(&self, endian: Self::Endian) -> u32; fn flags(&self, endian: Self::Endian) -> u32; // Provided methods fn parse<'data, R: ReadRef<'data>>( data: R, offset: u64, ) -> Result<&'data Self> { ... } fn is_supported(&self) -> bool { ... } fn endian(&self) -> Result<Self::Endian> { ... } fn load_commands<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, header_offset: u64, ) -> Result<LoadCommandIterator<'data, Self::Endian>> { ... } fn uuid<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, header_offset: u64, ) -> Result<Option<[u8; 16]>> { ... }
}
Expand description

A trait for generic access to macho::MachHeader32 and macho::MachHeader64.

Required Associated Types§

source

type Word: Into<u64>

source

type Endian: Endian

source

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

source

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

source

type Nlist: Nlist<Endian = Self::Endian>

Required Methods§

source

fn is_type_64(&self) -> bool

Return true if this type is a 64-bit header.

This is a property of the type, not a value in the header data.

source

fn is_big_endian(&self) -> bool

Return true if the magic field signifies big-endian.

source

fn is_little_endian(&self) -> bool

Return true if the magic field signifies little-endian.

source

fn magic(&self) -> u32

source

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

source

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

source

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

source

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

source

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

source

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

Provided Methods§

source

fn parse<'data, R: ReadRef<'data>>(data: R, offset: u64) -> Result<&'data Self>

Read the file header.

Also checks that the magic field in the file header is a supported format.

source

fn is_supported(&self) -> bool

source

fn endian(&self) -> Result<Self::Endian>

source

fn load_commands<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, header_offset: u64, ) -> Result<LoadCommandIterator<'data, Self::Endian>>

source

fn uuid<'data, R: ReadRef<'data>>( &self, endian: Self::Endian, data: R, header_offset: u64, ) -> Result<Option<[u8; 16]>>

Return the UUID from the LC_UUID load command, if one is present.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Endian: Endian> MachHeader for MachHeader32<Endian>

source§

type Word = u32

source§

type Endian = Endian

source§

type Segment = SegmentCommand32<Endian>

source§

type Section = Section32<Endian>

source§

type Nlist = Nlist32<Endian>

source§

impl<Endian: Endian> MachHeader for MachHeader64<Endian>

source§

type Word = u64

source§

type Endian = Endian

source§

type Segment = SegmentCommand64<Endian>

source§

type Section = Section64<Endian>

source§

type Nlist = Nlist64<Endian>