Struct TarballReader

Source
pub struct TarballReader<'c> {
    archive: Archive<CompressionDecoder<'c>>,
}
Expand description

A generic tarball reader that can be used to read both compressed tarballs .tar.* and uncompressed tar archives .tar.

Can be created from a Path or PathBuf, which will automatically detect the optional compression algorithm based on the file extension.

§Note

The lifetime 'c is for CompressionDecoder of the underlying Archive.

Fields§

§archive: Archive<CompressionDecoder<'c>>

Implementations§

Source§

impl<'c> TarballReader<'c>

Source

pub fn new(decoder: CompressionDecoder<'c>) -> Self

Creates a new TarballReader that reads from a CompressionDecoder.

Source

pub fn entries<'a>(&'a mut self) -> Result<TarballEntries<'a, 'c>, Error>

Returns an iterator over the entries in the tarball.

§Errors

Returns an error if Archive::entries fails.

Source

pub fn read_entry<'a, P: AsRef<Path>>( &'a mut self, path: P, ) -> Result<Option<TarballEntry<'a, 'c>>, Error>

Reads a specific TarballEntry by its path.

Returns None if the entry does not exist.

§Errors

Returns an error if Self::entries or reading an entry fails.

Trait Implementations§

Source§

impl Debug for TarballReader<'_>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl TryFrom<&Path> for TarballReader<'_>

Source§

fn try_from(path: &Path) -> Result<Self, Self::Error>

Creates a new TarballReader from a Path.

§Errors

Returns an error if

  • the file at path cannot be opened for reading,
  • the file extension is neither a .tar nor an extension of a supported compression algorithm,
  • a CompressionDecoder cannot be created from the file and DecompressionSettings.
Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

impl TryFrom<PathBuf> for TarballReader<'_>

Source§

fn try_from(path: PathBuf) -> Result<Self, Self::Error>

Creates a TarballReader from PathBuf.

Delegates to the TryFrom implementation for Path.

§Errors

Returns an error if the TryFrom implementation for Path fails.

Source§

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl<'c> !Freeze for TarballReader<'c>

§

impl<'c> !RefUnwindSafe for TarballReader<'c>

§

impl<'c> Send for TarballReader<'c>

§

impl<'c> !Sync for TarballReader<'c>

§

impl<'c> Unpin for TarballReader<'c>

§

impl<'c> !UnwindSafe for TarballReader<'c>

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

impl<T> ErasedDestructor for T
where T: 'static,