pub struct Archive<R: Read> { /* private fields */ }Expand description
Low-level streaming access to package archives.
This provides tar-style streaming access to archive entries. For most use
cases, prefer BinaryPackage which provides cached metadata and convenience
methods.
§Example
use pkgsrc::archive::{Archive, Compression};
use std::io::Read;
let mut archive = Archive::open("package-1.0.tgz").unwrap();
for entry in archive.entries().unwrap() {
let entry = entry.unwrap();
println!("{}", entry.path().unwrap().display());
}Implementations§
Source§impl<R: Read> Archive<R>
impl<R: Read> Archive<R>
Sourcepub fn new(reader: R) -> Result<Self>
pub fn new(reader: R) -> Result<Self>
Create a new archive from a reader.
Defaults to gzip compression. Use Archive::with_compression to
specify a different format, or Archive::open to auto-detect from
a file path.
Sourcepub fn with_compression(reader: R, compression: Compression) -> Result<Self>
pub fn with_compression(reader: R, compression: Compression) -> Result<Self>
Create a new archive from a reader with explicit compression.
Sourcepub fn compression(&self) -> Compression
pub fn compression(&self) -> Compression
Return the compression format.
Auto Trait Implementations§
impl<R> !Freeze for Archive<R>
impl<R> !RefUnwindSafe for Archive<R>
impl<R> Send for Archive<R>where
R: Send,
impl<R> !Sync for Archive<R>
impl<R> Unpin for Archive<R>where
R: Unpin,
impl<R> !UnwindSafe for Archive<R>
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