Struct ar::Archive

source ·
pub struct Archive<R: Read> { /* private fields */ }
Expand description

A structure for reading archives.

Implementations§

source§

impl<R: Read> Archive<R>

source

pub fn new(reader: R) -> Archive<R>

Create a new archive reader with the underlying reader object as the source of all data read.

source

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.

source

pub fn into_inner(self) -> Result<R>

Unwrap this archive reader, returning the underlying reader object.

source

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>

source

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

source

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

source

pub fn symbols(&mut self) -> Result<Symbols<'_, R>>

Scans the archive and returns an iterator over the symbols in the archive’s symbol table. If the archive doesn’t have a symbol table, this method will still succeed, but the iterator won’t produce any values.

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for Archive<R>where R: RefUnwindSafe,

§

impl<R> Send for Archive<R>where R: Send,

§

impl<R> Sync for Archive<R>where R: Sync,

§

impl<R> Unpin for Archive<R>where R: Unpin,

§

impl<R> UnwindSafe for Archive<R>where R: UnwindSafe,

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.