Struct ZipFileBuilder

Source
pub struct ZipFileBuilder<'archive, 'name, W> { /* private fields */ }
Expand description

A builder for creating a new file entry in a ZIP archive.

Implementations§

Source§

impl<'archive, W> ZipFileBuilder<'archive, '_, W>
where W: Write,

Source

pub fn compression_method(self, compression_method: CompressionMethod) -> Self

Sets the compression method for the file entry.

Source

pub fn last_modified(self, modification_time: UtcDateTime) -> Self

Sets the modification time for the file entry.

Only accepts UTC timestamps to ensure Extended Timestamp fields are written correctly.

Source

pub fn unix_permissions(self, permissions: u32) -> Self

Sets the Unix permissions for the file entry.

Accepts either:

  • Basic permission bits (e.g., 0o644 for rw-r–r–, 0o755 for rwxr-xr-x)
  • Full Unix mode including file type (e.g., 0o100644 for regular file, 0o040755 for directory)
  • Special permission bits are preserved (SUID: 0o4000, SGID: 0o2000, sticky: 0o1000)

When set, the archive will be created with Unix-compatible “version made by” field to ensure proper interpretation of the permissions by zip readers.

Source

pub fn create(self) -> Result<ZipEntryWriter<'archive, W>, Error>

Creates the file entry and returns a writer for the file’s content.

Trait Implementations§

Source§

impl<'archive, 'name, W: Debug> Debug for ZipFileBuilder<'archive, 'name, W>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'archive, 'name, W> Freeze for ZipFileBuilder<'archive, 'name, W>

§

impl<'archive, 'name, W> RefUnwindSafe for ZipFileBuilder<'archive, 'name, W>
where W: RefUnwindSafe,

§

impl<'archive, 'name, W> Send for ZipFileBuilder<'archive, 'name, W>
where W: Send,

§

impl<'archive, 'name, W> Sync for ZipFileBuilder<'archive, 'name, W>
where W: Sync,

§

impl<'archive, 'name, W> Unpin for ZipFileBuilder<'archive, 'name, W>

§

impl<'archive, 'name, W> !UnwindSafe for ZipFileBuilder<'archive, 'name, W>

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.