pub struct TarArchive { /* private fields */ }Expand description
An owning, validated Tar archive.
Unlike TarArchiveRef, this type takes ownership of the archive bytes.
TarArchive::new validates the supplied data before constructing the
archive.
This is only available with the alloc feature of this crate.
Implementations§
Source§impl TarArchive
impl TarArchive
Sourcepub fn new(data: Box<[u8]>) -> Result<Self, CorruptDataError>
pub fn new(data: Box<[u8]>) -> Result<Self, CorruptDataError>
Creates an owning wrapper around validated Tar archive bytes.
The supplied data must have a valid block layout, contain at least the minimum number of blocks, and end with two zero blocks. Each archive header must have a valid checksum and type flag, and every payload size must lead to a header or the terminating zero blocks within the archive.
Validation checks the archive structure required for safe iteration. It
does not guarantee that every supported entry can be consumed without
further format-specific limitations; see ArchiveEntryIterator.
Returns an error, if the sanity checks report problems.
§Errors
Returns CorruptDataError if validation fails.
Sourcepub fn entries(&self) -> ArchiveEntryIterator<'_> ⓘ
pub fn entries(&self) -> ArchiveEntryIterator<'_> ⓘ
Iterates over the regular files in the Tar archive.
See ArchiveEntryIterator for format support and limitations.
Sourcepub fn headers(&self) -> ArchiveHeaderIterator<'_> ⓘ
pub fn headers(&self) -> ArchiveHeaderIterator<'_> ⓘ
Iterates over the headers in the Tar archive.
PAX extended headers are returned as normal PosixHeader values,
while their payload blocks are skipped before the next iteration.
Trait Implementations§
Source§impl Clone for TarArchive
impl Clone for TarArchive
Source§fn clone(&self) -> TarArchive
fn clone(&self) -> TarArchive
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TarArchive
impl Debug for TarArchive
impl Eq for TarArchive
Source§impl From<TarArchive> for Box<[u8]>
Available on crate feature alloc only.
impl From<TarArchive> for Box<[u8]>
alloc only.