Struct FileOptions

struct FileOptions<'k, T: FileOptionExtension> { ... }

Metadata for a file to be written

Implementations

impl FileOptions<'_, ExtendedFileOptions>

fn add_extra_data<D: AsRef<[u8]>>(self: &mut Self, header_id: u16, data: D, central_only: bool) -> ZipResult<()>

Adds an extra data field.

fn clear_extra_data(self: Self) -> Self

Removes the extra data fields.

impl FileOptions<'static, ()>

impl<T: FileOptionExtension> FileOptions<'_, T>

const fn compression_method(self: Self, method: CompressionMethod) -> Self

Set the compression method for the new file

The default is CompressionMethod::Deflated if it is enabled. If not, CompressionMethod::Bzip2 is the default if it is enabled. If neither bzip2 nor deflate is enabled, CompressionMethod::Stored becomes the default and files are written uncompressed.

const fn compression_level(self: Self, level: Option<i64>) -> Self

Set the compression level for the new file

None value specifies default compression level.

Range of values depends on compression method:

  • Deflated: 10 - 264 for Zopfli, 0 - 9 for other encoders. Default is 24 if Zopfli is the only encoder, or 6 otherwise.
  • Bzip2: 0 - 9. Default is 6
  • Zstd: -7 - 22, with zero being mapped to default level. Default is 3
  • others: only None is allowed
const fn last_modified_time(self: Self, mod_time: DateTime) -> Self

Set the last modified time

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

const fn unix_permissions(self: Self, mode: u32) -> Self

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.

const fn large_file(self: Self, large: bool) -> Self

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 and the file is aborted. 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.

fn with_aes_encryption(self: Self, mode: AesMode, password: &str) -> FileOptions<'_, T>

Set the AES encryption parameters.

const fn with_zopfli_buffer(self: Self, size: Option<usize>) -> Self

Sets the size of the buffer used to hold the next block that Zopfli will compress. The larger the buffer, the more effective the compression, but the more memory is required. A value of None indicates no buffer, which is recommended only when all non-empty writes are larger than about 32 KiB.

const fn get_compression_level(self: &Self) -> Option<i64>

Returns the compression level currently set.

const fn with_alignment(self: Self, alignment: u16) -> Self

Sets the alignment to the given number of bytes.

impl<'k, T> Freeze for FileOptions<'k, T>

impl<'k, T> RefUnwindSafe for FileOptions<'k, T>

impl<'k, T> Send for FileOptions<'k, T>

impl<'k, T> Sync for FileOptions<'k, T>

impl<'k, T> Unpin for FileOptions<'k, T>

impl<'k, T> UnwindSafe for FileOptions<'k, T>

impl<'k, T: $crate::clone::Clone + FileOptionExtension> Clone for FileOptions<'k, T>

fn clone(self: &Self) -> FileOptions<'k, T>

impl<'k, T: $crate::cmp::Eq + FileOptionExtension> Eq for FileOptions<'k, T>

impl<'k, T: $crate::cmp::PartialEq + FileOptionExtension> PartialEq for FileOptions<'k, T>

fn eq(self: &Self, other: &FileOptions<'k, T>) -> bool

impl<'k, T: $crate::fmt::Debug + FileOptionExtension> Debug for FileOptions<'k, T>

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

impl<'k, T: $crate::marker::Copy + FileOptionExtension> Copy for FileOptions<'k, T>

impl<'k, T: FileOptionExtension> StructuralPartialEq for FileOptions<'k, T>

impl<Q, K> Equivalent for FileOptions<'k, T>

fn equivalent(self: &Self, key: &K) -> bool

impl<Q, K> Equivalent for FileOptions<'k, T>

fn equivalent(self: &Self, key: &K) -> bool

impl<T> Any for FileOptions<'k, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for FileOptions<'k, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for FileOptions<'k, T>

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

impl<T> CloneToUninit for FileOptions<'k, T>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for FileOptions<'k, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Same for FileOptions<'k, T>

impl<T> ToOwned for FileOptions<'k, T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for FileOptions<'k, T>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for FileOptions<'k, T>

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

impl<T, U> TryInto for FileOptions<'k, T>

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

impl<T: FileOptionExtension> Default for FileOptions<'_, T>

fn default() -> Self

Construct a new FileOptions object

impl<T: FileOptionExtension> FileOptionsExt for crate::write::FileOptions<'_, T>

fn with_deprecated_encryption(self: Self, password: &[u8]) -> FileOptions<'static, T>