cpio_archive

Trait CpioReader

Source
pub trait CpioReader<T>: Iterator<Item = CpioResult<Box<dyn CpioHeader>>> + Read
where T: Read + Sized,
{ // Required methods fn new(reader: T) -> Self where Self: Sized; fn read_next(&mut self) -> CpioResult<Option<Box<dyn CpioHeader>>>; fn finish(&mut self) -> CpioResult<()>; }
Expand description

Common interface for cpio archive reading.

In addition to the members of this trait, instances implement Iterator over the members of the archive and Read to obtain a reader for the current archive member.

Instances behave like a cursor over members of the archive. The cursor is advanced by calling Self::read_next. When the cursor is advanced, the Read trait will read data for this and only this archive member. The reader will hit EOF at the end of the current archive member.

Required Methods§

Source

fn new(reader: T) -> Self
where Self: Sized,

Construct a new instance from a reader.

Source

fn read_next(&mut self) -> CpioResult<Option<Box<dyn CpioHeader>>>

Read the next header from the archive.

Some on another file entry. None if at end of file.

The special TRAILER!!! entry is not emitted.

Source

fn finish(&mut self) -> CpioResult<()>

Finish reading the current member.

This will advance the reader to the next archive member if the current member hasn’t been fully consumed.

Implementors§