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
impl TarDecoder
Sourcepub fn new(limits: Limits) -> Self
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}Sourcepub fn probe(prefix: &[u8]) -> ProbeResult<()>
pub fn probe(prefix: &[u8]) -> ProbeResult<()>
Incrementally probes for a ustar/PAX/GNU tar header.
Trait Implementations§
Source§impl ArchiveDecoder for TarDecoder
impl ArchiveDecoder for TarDecoder
Source§fn step<'a>(
&'a mut self,
input: &'a [u8],
output: &'a mut [u8],
end: EndOfInput,
) -> Result<DecodeStep<'a>, ArchiveError>
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
impl Debug for TarDecoder
Auto Trait Implementations§
impl Freeze for TarDecoder
impl RefUnwindSafe for TarDecoder
impl Send for TarDecoder
impl Sync for TarDecoder
impl Unpin for TarDecoder
impl UnsafeUnpin for TarDecoder
impl UnwindSafe for TarDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more