pub struct FileOptions<'k, T>where
T: FileOptionExtension,{ /* private fields */ }Expand description
Metadata for a file to be written
Implementations§
Source§impl<T> FileOptions<'_, T>where
T: FileOptionExtension,
impl<T> FileOptions<'_, T>where
T: FileOptionExtension,
Sourcepub const fn compression_method(
self,
method: CompressionMethod,
) -> FileOptions<'_, T>
pub const fn compression_method( self, method: CompressionMethod, ) -> FileOptions<'_, T>
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.
Sourcepub const fn compression_level(self, level: Option<i64>) -> FileOptions<'_, T>
pub const fn compression_level(self, level: Option<i64>) -> FileOptions<'_, T>
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 6Zstd: -7 - 22, with zero being mapped to default level. Default is 3- others: only
Noneis allowed
Sourcepub const fn last_modified_time(self, mod_time: DateTime) -> FileOptions<'_, T>
pub const fn last_modified_time(self, mod_time: DateTime) -> FileOptions<'_, T>
Set the last modified time
The default is the current timestamp if the ‘time’ feature is enabled, and 1980-01-01 otherwise
Sourcepub const fn unix_permissions(self, mode: u32) -> FileOptions<'_, T>
pub const fn unix_permissions(self, mode: u32) -> FileOptions<'_, T>
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.
Sourcepub const fn large_file(self, large: bool) -> FileOptions<'_, T>
pub const fn large_file(self, large: bool) -> FileOptions<'_, T>
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.
Sourcepub fn with_aes_encryption(
self,
mode: AesMode,
password: &str,
) -> FileOptions<'_, T>
pub fn with_aes_encryption( self, mode: AesMode, password: &str, ) -> FileOptions<'_, T>
Set the AES encryption parameters.
Sourcepub const fn with_zopfli_buffer(self, size: Option<usize>) -> FileOptions<'_, T>
pub const fn with_zopfli_buffer(self, size: Option<usize>) -> FileOptions<'_, T>
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.
Sourcepub const fn get_compression_level(&self) -> Option<i64>
pub const fn get_compression_level(&self) -> Option<i64>
Returns the compression level currently set.
Sourcepub const fn with_alignment(self, alignment: u16) -> FileOptions<'_, T>
pub const fn with_alignment(self, alignment: u16) -> FileOptions<'_, T>
Sets the alignment to the given number of bytes.
Source§impl FileOptions<'_, ExtendedFileOptions>
impl FileOptions<'_, ExtendedFileOptions>
Sourcepub fn add_extra_data<D>(
&mut self,
header_id: u16,
data: D,
central_only: bool,
) -> Result<(), ZipError>
pub fn add_extra_data<D>( &mut self, header_id: u16, data: D, central_only: bool, ) -> Result<(), ZipError>
Adds an extra data field.
Sourcepub fn clear_extra_data(self) -> FileOptions<'_, ExtendedFileOptions>
pub fn clear_extra_data(self) -> FileOptions<'_, ExtendedFileOptions>
Removes the extra data fields.
Source§impl FileOptions<'static, ()>
impl FileOptions<'static, ()>
Sourcepub const DEFAULT: FileOptions<'static, ()>
pub const DEFAULT: FileOptions<'static, ()>
Constructs a const FileOptions object.
Note: This value is different than the return value of FileOptions::default():
- The
last_modified_timeisDateTime::DEFAULT. This corresponds to 1980-01-01 00:00:00
Trait Implementations§
Source§impl<'k, T> Clone for FileOptions<'k, T>where
T: Clone + FileOptionExtension,
impl<'k, T> Clone for FileOptions<'k, T>where
T: Clone + FileOptionExtension,
Source§fn clone(&self) -> FileOptions<'k, T>
fn clone(&self) -> FileOptions<'k, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'k, T> Debug for FileOptions<'k, T>where
T: Debug + FileOptionExtension,
impl<'k, T> Debug for FileOptions<'k, T>where
T: Debug + FileOptionExtension,
Source§impl<T> Default for FileOptions<'_, T>where
T: FileOptionExtension,
impl<T> Default for FileOptions<'_, T>where
T: FileOptionExtension,
Source§fn default() -> FileOptions<'_, T>
fn default() -> FileOptions<'_, T>
Construct a new FileOptions object
Source§impl<T> FileOptionsExt for FileOptions<'_, T>where
T: FileOptionExtension,
impl<T> FileOptionsExt for FileOptions<'_, T>where
T: FileOptionExtension,
Source§fn with_deprecated_encryption(self, password: &[u8]) -> FileOptions<'static, T>
fn with_deprecated_encryption(self, password: &[u8]) -> FileOptions<'static, T>
Source§impl<'k, T> PartialEq for FileOptions<'k, T>where
T: PartialEq + FileOptionExtension,
impl<'k, T> PartialEq for FileOptions<'k, T>where
T: PartialEq + FileOptionExtension,
impl<'k, T> Copy for FileOptions<'k, T>where
T: Copy + FileOptionExtension,
impl<'k, T> Eq for FileOptions<'k, T>where
T: Eq + FileOptionExtension,
impl<'k, T> StructuralPartialEq for FileOptions<'k, T>where
T: FileOptionExtension,
Auto Trait Implementations§
impl<'k, T> Freeze for FileOptions<'k, T>where
T: Freeze,
impl<'k, T> RefUnwindSafe for FileOptions<'k, T>where
T: RefUnwindSafe,
impl<'k, T> Send for FileOptions<'k, T>where
T: Send,
impl<'k, T> Sync for FileOptions<'k, T>where
T: Sync,
impl<'k, T> Unpin for FileOptions<'k, T>where
T: Unpin,
impl<'k, T> UnwindSafe for FileOptions<'k, T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> PowerToOwned for T
impl<T> PowerToOwned for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().