Struct Archive

Source
pub struct Archive<T: Read + Seek>(/* private fields */);
Expand description

Wrapper unifying the API of all the different compression formats supported by langs. Unfortunately the API is more complicated due to tar only supporting iterating through the files one by one, while zip only supports accessing by index.

Implementations§

Source§

impl<T: Read + Seek> Archive<T>

Source

pub fn new(archive: T, compression: Compression) -> Result<Self, TmcError>

Source

pub fn tar(archive: T) -> Self

Source

pub fn tar_zstd(archive: T) -> Result<Self, TmcError>

Source

pub fn zip(archive: T) -> Result<Self, TmcError>

Source

pub fn extract(self, target_directory: &Path) -> Result<(), TmcError>

Source

pub fn iter(&mut self) -> Result<ArchiveIterator<'_, T>, TmcError>

Source

pub fn by_path(&mut self, path: &str) -> Result<Entry<'_, T>, TmcError>

Source

pub fn compression(&self) -> Compression

Source

pub fn into_inner(self) -> T

Auto Trait Implementations§

§

impl<T> !Freeze for Archive<T>

§

impl<T> !RefUnwindSafe for Archive<T>

§

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

§

impl<T> !Sync for Archive<T>

§

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

§

impl<T> !UnwindSafe for Archive<T>

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