Skip to main content

LoadCommandData

Struct LoadCommandData 

Source
pub struct LoadCommandData<'data, E: Endian> { /* private fields */ }
Expand description

The data for a macho::LoadCommand.

Implementations§

Source§

impl<'data, E: Endian> LoadCommandData<'data, E>

Source

pub fn cmd(&self) -> u32

Return the cmd field of the macho::LoadCommand.

This is one of the LC_ constants.

Source

pub fn cmdsize(&self) -> u32

Return the cmdsize field of the macho::LoadCommand.

Source

pub fn data<T: Pod>(&self) -> Result<&'data T>

Parse the data as the given type.

Source

pub fn raw_data(&self) -> &'data [u8]

Raw bytes of this macho::LoadCommand structure.

Source

pub fn string(&self, endian: E, s: LcStr<E>) -> Result<&'data [u8]>

Parse a load command string value.

Strings used by load commands are specified by offsets that are relative to the load command header.

Source

pub fn variant(&self) -> Result<LoadCommandVariant<'data, E>>

Parse the command data according to the cmd field.

Source

pub fn segment_32( self, ) -> Result<Option<(&'data SegmentCommand32<E>, &'data [u8])>>

Try to parse this command as a macho::SegmentCommand32.

Returns the segment command and the data containing the sections.

Source

pub fn symtab(self) -> Result<Option<&'data SymtabCommand<E>>>

Try to parse this command as a macho::SymtabCommand.

Source

pub fn dysymtab(self) -> Result<Option<&'data DysymtabCommand<E>>>

Try to parse this command as a macho::DysymtabCommand.

Source

pub fn dylib(self) -> Result<Option<&'data DylibCommand<E>>>

Try to parse this command as a macho::DylibCommand.

See also Self::dylib_use_flags to read the optional flags field.

Source

pub fn dylib_use_flags( self, endian: E, dylib: &DylibCommand<E>, ) -> Result<Option<u32>>

Parse the optional flags field for a dylib load command.

macho::DylibCommand traditionally uses the load command type to distinguish between dylib kinds. macho::DylibUseCommand replaces this by encoding the kinds in a bitfield appended after the standard DylibCommand fields. Its presence is signalled using sentinel values in some DylibCommand fields.

Returns None if the sentinels are absent. If Some is returned, the value of macho::Dylib::timestamp should be ignored.

Source

pub fn uuid(self) -> Result<Option<&'data UuidCommand<E>>>

Try to parse this command as a macho::UuidCommand.

Source

pub fn segment_64( self, ) -> Result<Option<(&'data SegmentCommand64<E>, &'data [u8])>>

Try to parse this command as a macho::SegmentCommand64.

Source

pub fn dyld_info(self) -> Result<Option<&'data DyldInfoCommand<E>>>

Try to parse this command as a macho::DyldInfoCommand.

Source

pub fn entry_point(self) -> Result<Option<&'data EntryPointCommand<E>>>

Try to parse this command as an macho::EntryPointCommand.

Source

pub fn unix_thread( self, ) -> Result<Option<(&'data ThreadCommand<E>, &'data [u8])>>

Try to parse this command as an LC_UNIXTHREAD macho::ThreadCommand.

Returns the thread command and the thread state data that follows it.

Source

pub fn build_version(self) -> Result<Option<&'data BuildVersionCommand<E>>>

Try to parse this command as a macho::BuildVersionCommand.

Trait Implementations§

Source§

impl<'data, E: Clone + Endian> Clone for LoadCommandData<'data, E>

Source§

fn clone(&self) -> LoadCommandData<'data, E>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'data, E: Debug + Endian> Debug for LoadCommandData<'data, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'data, E: Copy + Endian> Copy for LoadCommandData<'data, E>

Auto Trait Implementations§

§

impl<'data, E> Freeze for LoadCommandData<'data, E>

§

impl<'data, E> RefUnwindSafe for LoadCommandData<'data, E>
where E: RefUnwindSafe,

§

impl<'data, E> Send for LoadCommandData<'data, E>
where E: Send,

§

impl<'data, E> Sync for LoadCommandData<'data, E>
where E: Sync,

§

impl<'data, E> Unpin for LoadCommandData<'data, E>
where E: Unpin,

§

impl<'data, E> UnsafeUnpin for LoadCommandData<'data, E>

§

impl<'data, E> UnwindSafe for LoadCommandData<'data, E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.