Archive

Struct Archive 

Source
pub struct Archive<R: ?Sized> { /* private fields */ }
Expand description

A DwarFS archive wrapping reader R.

Usually, you create a pair of Archive and ArchiveIndex using Archive::new. Directory hierarchy traversal can be done only on ArchiveIndex, and this struct is only needed for reading file content.

See also ArchiveIndex.

Implementations§

Source§

impl<R: ReadAt + Size> Archive<R>

Source

pub fn new(rdr: R) -> Result<(ArchiveIndex, Self)>

Load a DwarFS archive from a random-access stream, typically a std::fs::File.

Note 1: Do not use BufReader, because Archive already has internal caches. Use Config::block_cache_size_limit to configure its size.

Note 2: It’s discouraged to use positioned_io::RandomAccessFile on *NIX platforms because that would disable readahead which can hurt performance on sequential read inside a several MiB section. On Windows, however, RandomAccessFile is several times faster than File.

Source

pub fn new_with_config(rdr: R, config: &Config) -> Result<(ArchiveIndex, Self)>

Same as Archive::new but with a non-default Config.

Source

pub fn new_with_index_and_config( rdr: SectionReader<R>, index: &ArchiveIndex, config: &Config, ) -> Result<Self>

The low-level method for creating an Archive with already parsed ArchiveIndex.

Source§

impl<R> Archive<R>

Source

pub fn into_inner(self) -> R
where R: Sized,

Retrieve the ownership of the underlying reader.

Source

pub fn get_ref(&self) -> &R

Get a reference to the underlying reader.

Source

pub fn get_mut(&mut self) -> &mut R

Get a mutable reference to the underlying reader.

Trait Implementations§

Source§

impl<R: Debug + ?Sized> Debug for Archive<R>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Archive<R>
where R: Freeze + ?Sized,

§

impl<R> RefUnwindSafe for Archive<R>
where R: RefUnwindSafe + ?Sized,

§

impl<R> Send for Archive<R>
where R: Send + ?Sized,

§

impl<R> Sync for Archive<R>
where R: Sync + ?Sized,

§

impl<R> Unpin for Archive<R>
where R: Unpin + ?Sized,

§

impl<R> UnwindSafe for Archive<R>
where R: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.