pub struct Archive<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Archive<'a>
impl<'a> Archive<'a>
pub fn open<F>(source: Source<'a>, flags: F) -> Result<Archive<'a>>
Sourcepub fn close(self) -> Result<(), (Self, Error)>
pub fn close(self) -> Result<(), (Self, Error)>
Closes and consumes a zip file. If this fails, the failed-to-close zipfile and an error will be returned.
Sourcepub fn add<'b: 'a, N>(
&mut self,
name: N,
source: Source<'b>,
encoding: Encoding,
compression: Compression,
mode: Option<u16>,
mtime: Option<u32>,
overwrite: bool,
) -> Result<u64>
pub fn add<'b: 'a, N>( &mut self, name: N, source: Source<'b>, encoding: Encoding, compression: Compression, mode: Option<u16>, mtime: Option<u32>, overwrite: bool, ) -> Result<u64>
Add a file to the zip archive. Returns the index of the new file. The mtime parameter is given as a big-endian u32 DOS timestamp
Sourcepub fn add_dir_entry<N>(
&mut self,
name: N,
encoding: Encoding,
mode: Option<u16>,
mtime: Option<u32>,
) -> Result<u64>
pub fn add_dir_entry<N>( &mut self, name: N, encoding: Encoding, mode: Option<u16>, mtime: Option<u32>, ) -> Result<u64>
Add a directory entry to the zip archive. Returns the index of the new entry. The mtime parameter is given as a big-endian u32 DOS timestamp The source must outlive the archive, because according to the libzip interface, changes are only written when the archive is closed, and the source may be used until then. If you need to work with a short-lived source, consider closing and re-opening the archive for each operation.
Sourcepub fn replace<'b: 'a>(&mut self, index: u64, source: Source<'b>) -> Result<()>
pub fn replace<'b: 'a>(&mut self, index: u64, source: Source<'b>) -> Result<()>
Replace a file in the zip archive. The source must outlive the archive, because according to the libzip interface, changes are only written when the archive is closed, and the source may be used until then. If you need to work with a short-lived source, consider closing and re-opening the archive for each operation.