Struct archive_reader::Entry

source ·
pub struct Entry { /* private fields */ }
Expand description

Entry represents a file / dir in an archive.

Safety

Try not to keep entry objects! Entry has pointers pointing to the bytes in the archive. Every call on Entries::next will disable the pointers, and it is undefined behaviour to use the functions while the Entry is not pointing to the newest entry.

Implementations§

source§

impl Entry

source

pub unsafe fn file_name<F>(&self, decode: F) -> Result<Cow<'_, str>>where F: FnOnce(&[u8]) -> Option<Cow<'_, str>>,

file_name returns the name of the entry decoded with the provided decoder. It may fail if the decoder cannot decode the name.

Safety

Make sure the Entries::next has not been called again before calling. Calling this function while Entry is not pointing to the newest entry contains UB.

source

pub unsafe fn read_file_by_block( self ) -> impl Iterator<Item = Result<Box<[u8]>>> + Send

read_file_by_block returns an iterator of the entry content blocks.

Safety

Make sure the Entries::next has not been called again before calling. Calling this function while Entry is not pointing to the newest entry contains UB.

source

pub unsafe fn read_file<W: Write>(self, output: W) -> Result<usize>

read_file reads the content of this entry to an output.

Safety

Make sure the Entries::next has not been called again before calling. Calling this function while Entry is not pointing to the newest entry contains UB.

Trait Implementations§

Auto Trait Implementations§

§

impl RefUnwindSafe for Entry

§

impl !Sync for Entry

§

impl Unpin for Entry

§

impl UnwindSafe for Entry

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.