Struct symbolic_debuginfo::macho::MachArchive

source ·
pub struct MachArchive<'d>(/* private fields */);
Expand description

An archive that can consist of a single MachObject or a FatMachO container.

Executables and dSYM files on macOS can be a so-called Fat Mach Object: It contains multiple objects for several architectures. When loading this object, the operating system determines the object corresponding to the host’s architecture. This allows to distribute a single binary with optimizations for specific CPUs, which is frequently done on iOS.

To abstract over the differences, MachArchive simulates the archive interface also for single Mach objects. This allows uniform access to both file types.

Implementations§

source§

impl<'d> MachArchive<'d>

source

pub fn test(data: &[u8]) -> bool

Tests whether the buffer contains either a Mach Object or a Fat Mach Object.

source

pub fn parse(data: &'d [u8]) -> Result<Self, MachError>

Tries to parse a Mach archive from the given slice.

source

pub fn objects(&self) -> MachObjectIterator<'d, '_>

Returns an iterator over all objects contained in this archive.

source

pub fn object_count(&self) -> usize

Returns the number of objects in this archive.

source

pub fn object_by_index( &self, index: usize, ) -> Result<Option<MachObject<'d>>, MachError>

Resolves the object at the given index.

Returns Ok(None) if the index is out of bounds, or Err if the object exists but cannot be parsed.

source

pub fn is_multi(&self) -> bool

Returns whether this is a multi-object archive.

This may also return true if there is only a single object inside the archive.

Trait Implementations§

source§

impl<'slf, 'd: 'slf> AsSelf<'slf> for MachArchive<'d>

§

type Ref = MachArchive<'slf>

The Self type with 'slf lifetimes, returned by as_self.
source§

fn as_self(&'slf self) -> &Self::Ref

Returns a reference to self with downcasted lifetime.
source§

impl<'d> Debug for MachArchive<'d>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'d> Freeze for MachArchive<'d>

§

impl<'d> RefUnwindSafe for MachArchive<'d>

§

impl<'d> Send for MachArchive<'d>

§

impl<'d> Sync for MachArchive<'d>

§

impl<'d> Unpin for MachArchive<'d>

§

impl<'d> UnwindSafe for MachArchive<'d>

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<I, T> ExtractContext<I, ()> for T

source§

fn extract_context(self, _original_input: I)

Given the context attached to a nom error, and given the original input to the nom parser, extract more the useful context information. 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<I> RecreateContext<I> for I

source§

fn recreate_context(_original_input: I, tail: I) -> I

Given the original input, as well as the context reported by nom, recreate a context in the original string where the error occurred. Read more
source§

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

§

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>,

§

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.