pub struct Archive<'a> { /* private fields */ }
Expand description
An in-memory representation of a parsed Unix Archive
Implementations§
Source§impl<'a> Archive<'a>
impl<'a> Archive<'a>
pub fn parse(buffer: &'a [u8]) -> Result<Archive<'a>>
Sourcepub fn get(&self, member: &str) -> Option<&Member<'_>>
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.
Sourcepub fn get_at(&self, index: usize) -> Option<&Member<'_>>
pub fn get_at(&self, index: usize) -> Option<&Member<'_>>
Get the member at position index
in this archive, if any.
Sourcepub fn extract<'b>(&self, member: &str, buffer: &'b [u8]) -> Result<&'b [u8]>
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
Sourcepub fn summarize(&self) -> Vec<(&str, &Member<'_>, Vec<&'a str>)>
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
Sourcepub fn members(&self) -> Vec<&'a str>
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()
.
Sourcepub fn member_of_symbol(&self, symbol: &str) -> Option<&'a str>
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