pub struct Archive<R: Read> { /* private fields */ }
Expand description
A structure for reading archives.
Implementations§
source§impl<R: Read> Archive<R>
impl<R: Read> Archive<R>
sourcepub fn new(reader: R) -> Archive<R>
pub fn new(reader: R) -> Archive<R>
Create a new archive reader with the underlying reader object as the source of all data read.
sourcepub fn variant(&self) -> Variant
pub fn variant(&self) -> Variant
Returns which format variant this archive appears to be so far.
Note that this may not be accurate before the archive has been fully
read (i.e. before the next_entry()
method returns None
). In
particular, a new Archive
object that hasn’t yet read any data at all
will always return Variant::Common
.
sourcepub fn into_inner(self) -> Result<R>
pub fn into_inner(self) -> Result<R>
Unwrap this archive reader, returning the underlying reader object.
sourcepub fn next_entry(&mut self) -> Option<Result<Entry<'_, R>>>
pub fn next_entry(&mut self) -> Option<Result<Entry<'_, R>>>
Reads the next entry from the archive, or returns None if there are no more.
source§impl<R: Read + Seek> Archive<R>
impl<R: Read + Seek> Archive<R>
sourcepub fn count_entries(&mut self) -> Result<usize>
pub fn count_entries(&mut self) -> Result<usize>
Scans the archive and returns the total number of entries in the
archive (not counting special entries, such as the GNU archive name
table or symbol table, that are not returned by next_entry()
).
sourcepub fn jump_to_entry(&mut self, index: usize) -> Result<Entry<'_, R>>
pub fn jump_to_entry(&mut self, index: usize) -> Result<Entry<'_, R>>
Scans the archive and jumps to the entry at the given index. Returns
an error if the index is not less than the result of count_entries()
.