Struct zip::write::FileOptions

source ·
pub struct FileOptions { /* private fields */ }
Expand description

Metadata for a file to be written

Implementations§

source§

impl FileOptions

source

pub fn compression_method(self, method: CompressionMethod) -> FileOptions

Set the compression method for the new file

The default is CompressionMethod::Deflated. If the deflate compression feature is disabled, CompressionMethod::Stored becomes the default.

source

pub fn compression_level(self, level: Option<i32>) -> FileOptions

Set the compression level for the new file

None value specifies default compression level.

Range of values depends on compression method:

  • Deflated: 0 - 9. Default is 6
  • Bzip2: 0 - 9. Default is 6
  • Zstd: -7 - 22, with zero being mapped to default level. Default is 3
  • others: only None is allowed
source

pub fn last_modified_time(self, mod_time: DateTime) -> FileOptions

Set the last modified time

The default is the current timestamp if the ‘time’ feature is enabled, and 1980-01-01 otherwise

source

pub fn unix_permissions(self, mode: u32) -> FileOptions

Set the permissions for the new file.

The format is represented with unix-style permissions. The default is 0o644, which represents rw-r--r-- for files, and 0o755, which represents rwxr-xr-x for directories.

This method only preserves the file permissions bits (via a & 0o777) and discards higher file mode bits. So it cannot be used to denote an entry as a directory, symlink, or other special file type.

source

pub fn large_file(self, large: bool) -> FileOptions

Set whether the new file’s compressed and uncompressed size is less than 4 GiB.

If set to false and the file exceeds the limit, an I/O error is thrown. If set to true, readers will require ZIP64 support and if the file does not exceed the limit, 20 B are wasted. The default is false.

Trait Implementations§

source§

impl Clone for FileOptions

source§

fn clone(&self) -> FileOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for FileOptions

source§

fn default() -> Self

Construct a new FileOptions object

source§

impl FileOptionsExt for FileOptions

source§

fn with_deprecated_encryption(self, password: &[u8]) -> Self

Write the file with the given password using the deprecated ZipCrypto algorithm. Read more
source§

impl Copy for FileOptions

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.