Enum CompressionMethod

#[non_exhaustive]
pub enum CompressionMethod

Identifies the storage format used to compress a file within a ZIP archive.

Each file's compression method is stored alongside it, allowing the contents to be read without context.

When creating ZIP files, you may choose the method to use with crate::write::FileOptions::compression_method

Variants

Stored

Store the file as is

Deflated

Compress the file using Deflate

Deflate64

Compress the file using Deflate64. Decoding deflate64 is supported but encoding deflate64 is not supported.

Bzip2

Compress the file using BZIP2

Aes

Encrypted using AES.

The actual compression method has to be taken from the AES extra data field or from ZipFileData.

Zstd

Compress the file using ZStandard

Lzma

Compress the file using LZMA

Xz

Compress the file using XZ

Ppmd

Compress the file using PPMd

Unsupported(u16)

Unsupported compression method

Implementations

impl CompressionMethod

const fn name_from_u16(val: u16) -> &'static str

Convert the compression method (as u16) to a name

const fn from_u16(val: u16) -> CompressionMethod

Converts a u16 to its corresponding CompressionMethod

const fn to_u16(self) -> u16

Converts a CompressionMethod to a u16

impl CompressionMethod

const STORE: Self = CompressionMethod::Stored;
const SHRINK: Self = _;

Legacy compression method (enable feature legacy-zip to get support)

const REDUCE_1: Self = _;

Legacy compression method (enable feature legacy-zip to get support)

const REDUCE_2: Self = _;

Legacy compression method (enable feature legacy-zip to get support)

const REDUCE_3: Self = _;

Legacy compression method (enable feature legacy-zip to get support)

const REDUCE_4: Self = _;

Legacy compression method (enable feature legacy-zip to get support)

const IMPLODE: Self = _;

Legacy compression method (enable feature legacy-zip to get support)

const DEFLATE: Self = CompressionMethod::Deflated;
const DEFLATE64: Self = CompressionMethod::Deflate64;
const PKWARE_IMPLODE: Self = _;
const BZIP2: Self = CompressionMethod::Bzip2;
const LZMA: Self = CompressionMethod::Lzma;
const IBM_ZOS_CMPSC: Self = _;
const IBM_TERSE: Self = _;
const ZSTD_DEPRECATED: Self = _;
const ZSTD: Self = CompressionMethod::Zstd;
const MP3: Self = _;
const XZ: Self = CompressionMethod::Xz;
const JPEG: Self = _;
const WAVPACK: Self = _;
const PPMD: Self = CompressionMethod::Ppmd;
const AES: Self = CompressionMethod::Aes;
const DEFAULT: Self = CompressionMethod::Deflated;

Trait Implementations

impl Clone for CompressionMethod

fn clone(&self) -> CompressionMethod

impl Copy for CompressionMethod

impl Debug for CompressionMethod

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

impl Default for CompressionMethod

fn default() -> Self

impl Display for CompressionMethod

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

impl Eq for CompressionMethod

impl PartialEq for CompressionMethod

fn eq(&self, other: &CompressionMethod) -> bool

impl StructuralPartialEq for CompressionMethod

Auto Trait Implementations

impl Freeze for CompressionMethod

impl RefUnwindSafe for CompressionMethod

impl Send for CompressionMethod

impl Sync for CompressionMethod

impl Unpin for CompressionMethod

impl UnsafeUnpin for CompressionMethod

impl UnwindSafe for CompressionMethod

Blanket Implementations

impl<Q, K> Equivalent<K> for CompressionMethod where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

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

impl<Q, K> Equivalent<K> for CompressionMethod where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for CompressionMethod where T: Clone,

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

impl<T> From<T> for CompressionMethod

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Same for CompressionMethod

type Output = T;

impl<T> ToOwned for CompressionMethod where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for CompressionMethod where T: Display + ?Sized,

fn to_string(&self) -> String

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

fn into(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<U> for CompressionMethod where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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