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>
impl<'a> Entry<'a>
pub fn new(meta: EntryMeta, reader: Box<dyn Read + 'a>) -> Self
Sourcepub fn announce_links(self, links_to_come: u32) -> Self
pub fn announce_links(self, links_to_come: u32) -> Self
Marks this entry as one the reader KNOWS later entries in the same
archive are hard links to, and how many: links_to_come names besides
this one share it (cpio reads nlink; tar cannot know, so it never
sets this). A hint for consumers that keep payloads for later links,
so they can drop a payload once its last link has passed; never a
promise that a link follows, nor that no more will (an archive can
hold fewer names than nlink says, or a crafted larger count).
Sourcepub fn announces_links(&self) -> Option<u32>
pub fn announces_links(&self) -> Option<u32>
How many later hard links the reader announced to this entry; see
Self::announce_links. None unless a reader set it.