#[repr(C)]pub struct ZipFile {
pub entries: ZipFileEntryVec,
}Expand description
A ZIP archive that can be read from or written to
Fields§
§entries: ZipFileEntryVecThe entries in the archive
Implementations§
Source§impl ZipFile
impl ZipFile
Sourcepub fn list(
data: &[u8],
config: &ZipReadConfig,
) -> Result<ZipPathEntryVec, ZipReadError>
pub fn list( data: &[u8], config: &ZipReadConfig, ) -> Result<ZipPathEntryVec, ZipReadError>
Sourcepub fn get_single_file(
data: &[u8],
entry: &ZipPathEntry,
config: &ZipReadConfig,
) -> Result<Option<Vec<u8>>, ZipReadError>
pub fn get_single_file( data: &[u8], entry: &ZipPathEntry, config: &ZipReadConfig, ) -> Result<Option<Vec<u8>>, ZipReadError>
Sourcepub fn from_bytes(
data: Vec<u8>,
config: &ZipReadConfig,
) -> Result<Self, ZipReadError>
pub fn from_bytes( data: Vec<u8>, config: &ZipReadConfig, ) -> Result<Self, ZipReadError>
Load a ZIP archive from bytes
§Arguments
data- ZIP file bytes (consumed)config- Read configuration
Sourcepub fn from_file(
path: &Path,
config: &ZipReadConfig,
) -> Result<Self, ZipReadError>
pub fn from_file( path: &Path, config: &ZipReadConfig, ) -> Result<Self, ZipReadError>
Load a ZIP archive from a file path
Sourcepub fn to_bytes(
&self,
config: &ZipWriteConfig,
) -> Result<Vec<u8>, ZipWriteError>
pub fn to_bytes( &self, config: &ZipWriteConfig, ) -> Result<Vec<u8>, ZipWriteError>
Sourcepub fn to_file(
&self,
path: &Path,
config: &ZipWriteConfig,
) -> Result<(), ZipWriteError>
pub fn to_file( &self, path: &Path, config: &ZipWriteConfig, ) -> Result<(), ZipWriteError>
Write the ZIP archive to a file
Sourcepub fn add_file(&mut self, path: impl Into<String>, data: Vec<u8>)
pub fn add_file(&mut self, path: impl Into<String>, data: Vec<u8>)
Add a file entry (consumes the data, no clone)
Sourcepub fn add_directory(&mut self, path: impl Into<String>)
pub fn add_directory(&mut self, path: impl Into<String>)
Add a directory entry
Sourcepub fn get(&self, path: &str) -> Option<&ZipFileEntry>
pub fn get(&self, path: &str) -> Option<&ZipFileEntry>
Get an entry by path
Sourcepub fn filter_by_suffix(&self, suffix: &str) -> Vec<&ZipFileEntry>
pub fn filter_by_suffix(&self, suffix: &str) -> Vec<&ZipFileEntry>
Filter entries by suffix (e.g., “.fluent”, “.json”)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ZipFile
impl RefUnwindSafe for ZipFile
impl Send for ZipFile
impl Sync for ZipFile
impl Unpin for ZipFile
impl UnwindSafe for ZipFile
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more