pub struct TarArchiveRef<'a> { /* private fields */ }Expand description
Wrapper type around bytes, which represents a Tar archive. To iterate the
entries, use TarArchiveRef::entries.
Implementations§
Source§impl<'a> TarArchiveRef<'a>
impl<'a> TarArchiveRef<'a>
Sourcepub fn new(data: &'a [u8]) -> Result<Self, CorruptDataError>
pub fn new(data: &'a [u8]) -> Result<Self, CorruptDataError>
Creates a borrowed 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.
§Errors
Returns CorruptDataError if validation fails.
Sourcepub fn entries(&self) -> ArchiveEntryIterator<'a> ⓘ
pub fn entries(&self) -> ArchiveEntryIterator<'a> ⓘ
Iterates over the regular files in the Tar archive.
See ArchiveEntryIterator for format support and limitations.
Sourcepub fn headers(&self) -> ArchiveHeaderIterator<'a> ⓘ
pub fn headers(&self) -> ArchiveHeaderIterator<'a> ⓘ
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<'a> Clone for TarArchiveRef<'a>
impl<'a> Clone for TarArchiveRef<'a>
Source§fn clone(&self) -> TarArchiveRef<'a>
fn clone(&self) -> TarArchiveRef<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more