pub struct Archive<'d>(/* private fields */);
Expand description

A generic archive that can contain one or more object files.

Effectively, this will only contain a single object for all file types other than MachO. Mach objects can either be single object files or so-called fat files that contain multiple objects per architecture.

Implementations§

source§

impl<'d> Archive<'d>

source

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

Tests whether this buffer contains a valid object archive.

source

pub fn peek(data: &[u8]) -> FileFormat

Tries to infer the object archive type from the start of the given buffer.

source

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

Tries to parse a generic archive from the given slice.

source

pub fn file_format(&self) -> FileFormat

The container format of this file.

source

pub fn objects(&self) -> ObjectIterator<'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<Object<'d>>, ObjectError>

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 Archive<'d>

§

type Ref = Archive<'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 Archive<'d>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'d> !RefUnwindSafe for Archive<'d>

§

impl<'d> Send for Archive<'d>

§

impl<'d> Sync for Archive<'d>

§

impl<'d> Unpin for Archive<'d>

§

impl<'d> !UnwindSafe for Archive<'d>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.