Skip to main content

TarDecoder

Struct TarDecoder 

Source
pub struct TarDecoder { /* private fields */ }
Expand description

v0.2 incremental tar decoder.

This is the first format implementation of the unified ArchiveDecoder contract. It wraps the proven tar state machine while the old entry-cursor surface is removed from the remaining formats.

Implementations§

Source§

impl TarDecoder

Source

pub fn new(limits: Limits) -> Self

Creates a decoder with explicit resource budgets.

Examples found in repository?
examples/sans_io.rs (line 11)
9fn main() -> Result<(), libarchive_oxide_core::ArchiveError> {
10    let archive = [0_u8; 1024];
11    let mut decoder = TarDecoder::new(Limits::default());
12    let mut position = 0;
13    let mut scratch = [0_u8; 4096];
14
15    loop {
16        let step = decoder.step(&archive[position..], &mut scratch, EndOfInput::End)?;
17        position += step.consumed;
18        if matches!(step.event, DecodeEvent::Done) {
19            return Ok(());
20        }
21    }
22}
Source

pub fn probe(prefix: &[u8]) -> ProbeResult<()>

Incrementally probes for a ustar/PAX/GNU tar header.

Trait Implementations§

Source§

impl ArchiveDecoder for TarDecoder

Source§

fn step<'a>( &'a mut self, input: &'a [u8], output: &'a mut [u8], end: EndOfInput, ) -> Result<DecodeStep<'a>, ArchiveError>

Consumes archive bytes and produces at most one structural event.
Source§

impl Debug for TarDecoder

Source§

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

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

impl Default for TarDecoder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.