Struct Archive

Source
pub struct Archive { /* private fields */ }

Implementations§

Source§

impl Archive

Source

pub fn open<S, F>(source: Source<S>, flags: F) -> Result<Archive>
where F: AsRef<[OpenFlag]>,

Source

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.

Source

pub fn discard(self)

Discard and consume the zipfile. This will never fail.

Source

pub fn add<N, S>( &mut self, name: N, source: Source<S>, encoding: Encoding, overwrite: bool, ) -> Result<u64>
where N: AsRef<CStr>,

Add a file to the zip archive. Returns the index of the new file.

Source

pub fn replace<S>(&mut self, index: u64, source: Source<S>) -> Result<()>

Replace a file in the zip archive.

Source

pub fn open_file<N, O, L>( &mut self, name: N, open_flags: O, locate_flags: L, ) -> Result<File<'_>>
where N: AsRef<CStr>, O: AsRef<[FileOpenFlag]>, L: AsRef<[LocateFlag]>,

Add a file to the zip archive. Returns the index of the new file.

Trait Implementations§

Source§

impl Debug for Archive

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Archive

Closes the archive, silently discarding on error. It’s strongly recommended to use the Archive::close method instead and validate that no errors have occurred.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.