Struct goblin::archive::Archive

source ·
pub struct Archive<'a> { /* private fields */ }
Expand description

An in-memory representation of a parsed Unix Archive

Implementations§

source§

impl<'a> Archive<'a>

source

pub fn parse(buffer: &'a [u8]) -> Result<Archive<'a>>

source

pub fn get(&self, member: &str) -> Option<&Member<'_>>

Get the member named member in this archive, if any. If there are multiple files in the archive with the same name it only returns one of them.

source

pub fn get_at(&self, index: usize) -> Option<&Member<'_>>

Get the member at position index in this archive, if any.

source

pub fn len(&self) -> usize

Return the number of archive members.

source

pub fn extract<'b>(&self, member: &str, buffer: &'b [u8]) -> Result<&'b [u8]>

Returns a slice of the raw bytes for the given member in the scrollable buffer

source

pub fn summarize(&self) -> Vec<(&str, &Member<'_>, Vec<&'a str>)>

Gets a summary of this archive, returning a list of membername, the member, and the list of symbols the member contains

source

pub fn members(&self) -> Vec<&'a str>

Get the list of member names in this archive

This returns members in alphabetical order, not in the order they occurred in the archive. If there are multiple files with the same name, the size of the returned array will be less than the size of len().

source

pub fn member_of_symbol(&self, symbol: &str) -> Option<&'a str>

Returns the member’s name which contains the given symbol, if it is in the archive

Trait Implementations§

source§

impl<'a> Debug for Archive<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Archive<'a>

§

impl<'a> Send for Archive<'a>

§

impl<'a> Sync for Archive<'a>

§

impl<'a> Unpin for Archive<'a>

§

impl<'a> UnwindSafe for Archive<'a>

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