pub struct Archive {
pub blocks: Vec<Block>,
pub files: Vec<ArchiveEntry>,
pub stream_map: StreamMap,
pub is_solid: bool,
/* private fields */
}
Expand description
Represents a parsed 7z archive structure.
Contains metadata about the archive including files, compression blocks, and internal structure information necessary for decompression.
Fields§
§blocks: Vec<Block>
Compression blocks in the archive.
files: Vec<ArchiveEntry>
File and directory entries in the archive.
stream_map: StreamMap
Mapping between files, blocks, and pack streams.
is_solid: bool
Whether this is a solid archive (better compression, slower random access).
Implementations§
Source§impl Archive
impl Archive
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Archive, Error>
pub fn open(path: impl AsRef<Path>) -> Result<Archive, Error>
Open 7z file under specified path
.
Sourcepub fn open_with_password(
path: impl AsRef<Path>,
password: &Password,
) -> Result<Archive, Error>
pub fn open_with_password( path: impl AsRef<Path>, password: &Password, ) -> Result<Archive, Error>
Open an encrypted 7z file under specified path
with password
.
§Parameters
reader
- the path to the 7z filepassword
- archive password encoded in utf16 little endian
Sourcepub fn read<R: Read + Seek>(
reader: &mut R,
password: &Password,
) -> Result<Archive, Error>
pub fn read<R: Read + Seek>( reader: &mut R, password: &Password, ) -> Result<Archive, Error>
Read 7z file archive info use the specified reader
.
§Parameters
reader
- the reader of the 7z filr archivepassword
- archive password encoded in utf16 little endian
§Example
use std::{
fs::File,
io::{Read, Seek},
};
use sevenz_rust2::*;
let mut reader = File::open("example.7z").unwrap();
let password = Password::from("the password");
let archive = Archive::read(&mut reader, &password).unwrap();
for entry in &archive.files {
println!("{}", entry.name());
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Archive
impl RefUnwindSafe for Archive
impl Send for Archive
impl Sync for Archive
impl Unpin for Archive
impl UnwindSafe for Archive
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