Skip to main content

TarArchive

Struct TarArchive 

Source
pub struct TarArchive<R> { /* private fields */ }
Expand description

This type reads one structurally valid pax or GNU tar archive in one pass.

Member paths and link targets are not normalized for extraction. A direct consumer must validate them before it uses them as file-system paths.

By default, member iteration validates final record padding and waits for EOF before reporting the end of the archive. See DecodePolicy::trailing_data_policy.

After a member or payload read returns an error, subsequent reads return DecodeError::Poisoned. At the end of the archive, member iteration returns Ok(None). Cancelled reads can be retried.

ArchiveTrait::extract_in validates member paths and link targets during extraction.

Implementations§

Source§

impl<R> TarArchive<R>

Source

pub fn new(reader: R) -> Self

Creates an archive decoder from an uncompressed tar reader.

Source

pub fn with_policy(self, policy: DecodePolicy) -> Self

Configures the decoding policy used by this archive.

Call before reading any members.

Trait Implementations§

Source§

impl<R: AsyncRead + Unpin> Archive for TarArchive<R>

Source§

type Error = DecodeError

The archive-format error returned during member iteration.
Source§

type Payload<'a> = TarMemberPayload<'a, R>
where Self: 'a,

The streaming payload type lent by each file member.
Source§

async fn next_member<'a>( &'a mut self, ) -> Result<Option<Member<Self::Payload<'a>>>, Self::Error>

Reads the next format-neutral member for Members::next. Read more
Source§

fn members(self) -> Members<Self>

Consumes this archive and returns its lending member cursor. Read more
Source§

async fn extract_in<P>( self, destination: P, policy: ExtractPolicy, ) -> Result<(), ExtractError<Self::Error>>
where P: AsRef<Path>,

Securely extracts this archive beneath destination under policy. Read more

Auto Trait Implementations§

§

impl<R> Forget for TarArchive<R>

§

impl<R> Freeze for TarArchive<R>
where *const u8 is !null: Freeze, PhantomData<PaxRecord>: Freeze, PhantomData<(PaxKeyword, usize)>: Freeze, R: Freeze, PhantomData<u8>: Freeze, *const ArcInner<PaxRecords> is !null: Freeze, PhantomData<ArcInner<PaxRecords>>: Freeze, PhantomData<PaxExtension>: Freeze, PhantomData<(&'static str, ())>: Freeze,

§

impl<R> Move for TarArchive<R>

§

impl<R> RefUnwindSafe for TarArchive<R>

§

impl<R> Send for TarArchive<R>
where R: Send, RawVecInner: Send, Arc<str>: Send, Arc<[u8]>: Send, RawTable<(PaxKeyword, usize)>: Send, Arc<PaxRecords>: Send, RawTable<(&'static str, ())>: Send,

§

impl<R> Sync for TarArchive<R>
where R: Sync, RawVecInner: Sync, Arc<str>: Sync, Arc<[u8]>: Sync, RawTable<(PaxKeyword, usize)>: Sync, Arc<PaxRecords>: Sync, RawTable<(&'static str, ())>: Sync,

§

impl<R> Unpin for TarArchive<R>
where R: Unpin, *const u8 is !null: Unpin, Arc<str>: Unpin, Arc<[u8]>: Unpin, Arc<PaxRecords>: Unpin, &'static str: Unpin,

§

impl<R> UnsafeUnpin for TarArchive<R>

§

impl<R> UnwindSafe for TarArchive<R>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.