Skip to main content

Entry

Struct Entry 

Source
pub struct Entry<'a> { /* private fields */ }
Expand description

One entry, borrowed from the archive it came from.

The reader is deliberately not Send. It was until Phase 2’s first real container, and the bound was unsound to require: tar::Entry holds &Archive<dyn Read> over a RefCell, so it is !Send for any reader, and every container built on the tar crate would have had to assert unsafe impl Send for a property that is false — a lie that becomes UB the day anything actually sends one.

Nothing needs it. An entry borrows the archive it came from (ArchiveRead::next_entry(&mut self) -> Entry<'_>), so sending an entry to another thread would mean sending the archive with it, and no caller in this tree does either: entries are read on the thread that asked for them. Dropping the bound is strictly more permissive, so a container whose reader IS Send is unaffected.

Implementations§

Source§

impl<'a> Entry<'a>

Source

pub fn new(meta: EntryMeta, reader: Box<dyn Read + 'a>) -> Self

Source

pub fn meta(&self) -> &EntryMeta

Source

pub fn reader(&mut self) -> &mut (dyn Read + 'a)

Trait Implementations§

Source§

impl Debug for Entry<'_>

Manual impl: reader is Box<dyn Read>, which cannot derive Debug. Needed so Result<Entry<'_>, Error>::unwrap_err() type-checks in tests (unwrap_err requires the Ok side to be Debug).

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Entry<'a>

§

impl<'a> !Send for Entry<'a>

§

impl<'a> !Sync for Entry<'a>

§

impl<'a> !UnwindSafe for Entry<'a>

§

impl<'a> Freeze for Entry<'a>

§

impl<'a> Unpin for Entry<'a>

§

impl<'a> UnsafeUnpin for Entry<'a>

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.