pub struct Decoder<R: Read> { /* private fields */ }Expand description
Decoder that can extract the contents of NAR files.
Implementations
sourceimpl<R: Read> Decoder<R>
impl<R: Read> Decoder<R>
Create a new decoder over the given Reader.
Consider wrapping it in a std::io::BufReader for
performance.
pub fn new(reader: R) -> Result<Self, NarError>
sourcepub fn entries(&self) -> Result<Entries<'_, R>, NarError>
pub fn entries(&self) -> Result<Entries<'_, R>, NarError>
Construct an iterator over the entries in this archive.
You must consider each entry within an archive in sequence. If entries are processed out of sequence (from what the iterator returns), then the contents read for each entry may be corrupted.
sourcepub fn unpack<P: AsRef<Path>>(&self, dst: P) -> Result<(), NarError>
pub fn unpack<P: AsRef<Path>>(&self, dst: P) -> Result<(), NarError>
Unpacks the contents of the NAR file to the given destination (which must not already exist).
This operation will not not write files outside of the path
specified by dst. Files in the archive which have a .. in
their path are skipped during the unpacking process.
No attempt is made to validate the targets of symlinks.
If the NAR file is invalid, this function returns an error.
For instance, this happens if an Entry’s parent doesn’t
exist or is not a directory.
Auto Trait Implementations
impl<R> !RefUnwindSafe for Decoder<R>
impl<R> Send for Decoder<R> where
R: Send,
impl<R> !Sync for Decoder<R>
impl<R> Unpin for Decoder<R> where
R: Unpin,
impl<R> UnwindSafe for Decoder<R> where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more