Struct libpna::RegularEntry
source · pub struct RegularEntry<T = Vec<u8>> { /* private fields */ }Expand description
Entry that read from PNA archive.
Implementations§
source§impl<T> RegularEntry<T>
impl<T> RegularEntry<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> RegularEntry<T>
impl<T: Clone> RegularEntry<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]>> RegularEntry<T>
impl<T: AsRef<[u8]>> RegularEntry<T>
sourcepub fn reader(&self, option: ReadOptions) -> Result<EntryDataReader<'_>>
pub fn reader(&self, option: ReadOptions) -> Result<EntryDataReader<'_>>
Return the reader of this RegularEntry.
§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 RegularEntry<T>
impl<T: Clone> Clone for RegularEntry<T>
source§fn clone(&self) -> RegularEntry<T>
fn clone(&self) -> RegularEntry<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 RegularEntry<T>
impl<T: Debug> Debug for RegularEntry<T>
source§impl<'a> From<RegularEntry<&'a [u8]>> for RegularEntry<Vec<u8>>
impl<'a> From<RegularEntry<&'a [u8]>> for RegularEntry<Vec<u8>>
source§fn from(value: RegularEntry<&'a [u8]>) -> Self
fn from(value: RegularEntry<&'a [u8]>) -> Self
Converts to this type from the input type.
source§impl<'a> From<RegularEntry<&'a [u8]>> for RegularEntry<Cow<'a, [u8]>>
impl<'a> From<RegularEntry<&'a [u8]>> for RegularEntry<Cow<'a, [u8]>>
source§fn from(value: RegularEntry<&'a [u8]>) -> Self
fn from(value: RegularEntry<&'a [u8]>) -> Self
Converts to this type from the input type.
source§impl<'a> From<RegularEntry<Cow<'a, [u8]>>> for RegularEntry<Vec<u8>>
impl<'a> From<RegularEntry<Cow<'a, [u8]>>> for RegularEntry<Vec<u8>>
source§impl<'a> From<RegularEntry> for RegularEntry<Cow<'a, [u8]>>
impl<'a> From<RegularEntry> for RegularEntry<Cow<'a, [u8]>>
source§impl<T: Hash> Hash for RegularEntry<T>
impl<T: Hash> Hash for RegularEntry<T>
source§impl<T: Ord> Ord for RegularEntry<T>
impl<T: Ord> Ord for RegularEntry<T>
source§fn cmp(&self, other: &RegularEntry<T>) -> Ordering
fn cmp(&self, other: &RegularEntry<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 RegularEntry<T>
impl<T: PartialEq> PartialEq for RegularEntry<T>
source§impl<T: PartialOrd> PartialOrd for RegularEntry<T>
impl<T: PartialOrd> PartialOrd for RegularEntry<T>
impl<T> Entry for RegularEntry<T>where
RegularEntry<T>: SealedEntryExt,
impl<T: Eq> Eq for RegularEntry<T>
impl<T> StructuralPartialEq for RegularEntry<T>
Auto Trait Implementations§
impl<T> Freeze for RegularEntry<T>
impl<T> RefUnwindSafe for RegularEntry<T>where
T: RefUnwindSafe,
impl<T> Send for RegularEntry<T>where
T: Send,
impl<T> Sync for RegularEntry<T>where
T: Sync,
impl<T> Unpin for RegularEntry<T>where
T: Unpin,
impl<T> UnwindSafe for RegularEntry<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)