pub struct NormalEntry<T = Vec<u8>> { /* private fields */ }Expand description
Entry that read from PNA archive.
Implementations§
Source§impl<T> NormalEntry<T>
impl<T> NormalEntry<T>
Sourcepub fn header(&self) -> &EntryHeader
pub fn header(&self) -> &EntryHeader
Information in the header of the entry.
Sourcepub fn xattrs(&self) -> &[ExtendedAttribute]
pub fn xattrs(&self) -> &[ExtendedAttribute]
Extended attributes of the entry.
Sourcepub fn extra_chunks(&self) -> &[RawChunk<T>]
pub fn extra_chunks(&self) -> &[RawChunk<T>]
Extra chunks.
Sourcepub fn with_metadata(self, metadata: Metadata) -> Self
pub fn with_metadata(self, metadata: Metadata) -> Self
Apply metadata to the entry.
§Example
use libpna::{EntryBuilder, Metadata};
let mut entry = EntryBuilder::new_dir("dir_entry".into()).build()?;
entry.with_metadata(Metadata::new());Sourcepub fn with_xattrs(self, xattrs: &[ExtendedAttribute]) -> Self
pub fn with_xattrs(self, xattrs: &[ExtendedAttribute]) -> Self
Apply extended attributes to the entry.
§Example
use libpna::{EntryBuilder, ExtendedAttribute};
let mut entry = EntryBuilder::new_dir("dir_entry".into()).build()?;
entry.with_xattrs(&[ExtendedAttribute::new("key".into(), b"value".into())]);Source§impl<T: Clone> NormalEntry<T>
impl<T: Clone> NormalEntry<T>
Sourcepub fn with_extra_chunks(self, chunks: &[RawChunk<T>]) -> Self
pub fn with_extra_chunks(self, chunks: &[RawChunk<T>]) -> Self
Apply extra chunks to the entry.
§Example
use libpna::{ChunkType, EntryBuilder, RawChunk};
let mut entry = EntryBuilder::new_dir("dir_entry".into()).build()?;
entry.with_extra_chunks(&[RawChunk::from_data(
ChunkType::private(*b"myTy").unwrap(),
b"some data",
)]);Source§impl<T: AsRef<[u8]>> NormalEntry<T>
impl<T: AsRef<[u8]>> NormalEntry<T>
Sourcepub fn reader(&self, option: impl ReadOption) -> Result<EntryDataReader<'_>>
pub fn reader(&self, option: impl ReadOption) -> Result<EntryDataReader<'_>>
Return the reader of this NormalEntry.
§Examples
use libpna::{Archive, ReadOptions};
use std::{fs, io};
let file = fs::File::open("foo.pna")?;
let mut archive = Archive::read_header(file)?;
for entry in archive.entries_skip_solid() {
let entry = entry?;
let mut reader = entry.reader(ReadOptions::builder().build())?;
let name = entry.header().path();
let mut dist_file = fs::File::create(name)?;
io::copy(&mut reader, &mut dist_file)?;
}Trait Implementations§
Source§impl<T: Clone> Clone for NormalEntry<T>
impl<T: Clone> Clone for NormalEntry<T>
Source§fn clone(&self) -> NormalEntry<T>
fn clone(&self) -> NormalEntry<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for NormalEntry<T>
impl<T: Debug> Debug for NormalEntry<T>
Source§impl<'a> From<NormalEntry<&'a [u8]>> for NormalEntry<Vec<u8>>
impl<'a> From<NormalEntry<&'a [u8]>> for NormalEntry<Vec<u8>>
Source§fn from(value: NormalEntry<&'a [u8]>) -> Self
fn from(value: NormalEntry<&'a [u8]>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<NormalEntry<&'a [u8]>> for NormalEntry<Cow<'a, [u8]>>
impl<'a> From<NormalEntry<&'a [u8]>> for NormalEntry<Cow<'a, [u8]>>
Source§fn from(value: NormalEntry<&'a [u8]>) -> Self
fn from(value: NormalEntry<&'a [u8]>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<NormalEntry<Cow<'a, [u8]>>> for NormalEntry<Vec<u8>>
impl<'a> From<NormalEntry<Cow<'a, [u8]>>> for NormalEntry<Vec<u8>>
Source§impl<T> From<NormalEntry<T>> for ReadEntry<T>
impl<T> From<NormalEntry<T>> for ReadEntry<T>
Source§fn from(value: NormalEntry<T>) -> Self
fn from(value: NormalEntry<T>) -> Self
Converts to this type from the input type.
Source§impl From<NormalEntry> for NormalEntry<Cow<'_, [u8]>>
impl From<NormalEntry> for NormalEntry<Cow<'_, [u8]>>
Source§impl<T: Hash> Hash for NormalEntry<T>
impl<T: Hash> Hash for NormalEntry<T>
Source§impl<T: Ord> Ord for NormalEntry<T>
impl<T: Ord> Ord for NormalEntry<T>
Source§fn cmp(&self, other: &NormalEntry<T>) -> Ordering
fn cmp(&self, other: &NormalEntry<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq> PartialEq for NormalEntry<T>
impl<T: PartialEq> PartialEq for NormalEntry<T>
Source§impl<T: PartialOrd> PartialOrd for NormalEntry<T>
impl<T: PartialOrd> PartialOrd for NormalEntry<T>
impl<T> Entry for NormalEntry<T>where
NormalEntry<T>: SealedEntryExt,
impl<T: Eq> Eq for NormalEntry<T>
impl<T> StructuralPartialEq for NormalEntry<T>
Auto Trait Implementations§
impl<T> Freeze for NormalEntry<T>
impl<T> RefUnwindSafe for NormalEntry<T>where
T: RefUnwindSafe,
impl<T> Send for NormalEntry<T>where
T: Send,
impl<T> Sync for NormalEntry<T>where
T: Sync,
impl<T> Unpin for NormalEntry<T>where
T: Unpin,
impl<T> UnwindSafe for NormalEntry<T>where
T: UnwindSafe,
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