#[non_exhaustive]pub enum CompressionAlgorithm {
Uncompressed,
Zip,
Zlib,
BZip2,
Private(u8),
Unknown(u8),
}
Expand description
The OpenPGP compression algorithms as defined in Section 9.3 of RFC 4880.
Note: This enum cannot be exhaustively matched to allow future extensions.
§Examples
Use CompressionAlgorithm
to set the preferred compressions algorithms on
a signature:
use sequoia_openpgp as openpgp;
use openpgp::packet::signature::SignatureBuilder;
use openpgp::types::{HashAlgorithm, CompressionAlgorithm, SignatureType};
let mut builder = SignatureBuilder::new(SignatureType::DirectKey)
.set_hash_algo(HashAlgorithm::SHA512)
.set_preferred_compression_algorithms(vec![
CompressionAlgorithm::Zlib,
CompressionAlgorithm::BZip2,
])?;
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Uncompressed
Null compression.
Zip
DEFLATE Compressed Data.
See RFC 1951 for details. Section 9.3 of RFC 4880 recommends that this algorithm should be implemented.
Zlib
ZLIB Compressed Data.
See RFC 1950 for details.
BZip2
bzip2
Private(u8)
Private compression algorithm identifier.
Unknown(u8)
Unknown compression algorithm identifier.
Implementations§
source§impl CompressionAlgorithm
impl CompressionAlgorithm
sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Returns whether this algorithm is supported.
§Examples
use sequoia_openpgp as openpgp;
use openpgp::types::CompressionAlgorithm;
assert!(CompressionAlgorithm::Uncompressed.is_supported());
assert!(!CompressionAlgorithm::Private(101).is_supported());
sourcepub fn variants() -> impl Iterator<Item = Self>
pub fn variants() -> impl Iterator<Item = Self>
Returns an iterator over all valid variants.
Returns an iterator over all known variants. This does not
include the CompressionAlgorithm::Private
, or
CompressionAlgorithm::Unknown
variants.
Trait Implementations§
source§impl Clone for CompressionAlgorithm
impl Clone for CompressionAlgorithm
source§fn clone(&self) -> CompressionAlgorithm
fn clone(&self) -> CompressionAlgorithm
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CompressionAlgorithm
impl Debug for CompressionAlgorithm
source§impl Default for CompressionAlgorithm
impl Default for CompressionAlgorithm
source§impl Display for CompressionAlgorithm
impl Display for CompressionAlgorithm
source§impl From<CompressionAlgorithm> for u8
impl From<CompressionAlgorithm> for u8
source§fn from(c: CompressionAlgorithm) -> u8
fn from(c: CompressionAlgorithm) -> u8
Converts to this type from the input type.
source§impl From<u8> for CompressionAlgorithm
impl From<u8> for CompressionAlgorithm
source§impl Hash for CompressionAlgorithm
impl Hash for CompressionAlgorithm
source§impl Ord for CompressionAlgorithm
impl Ord for CompressionAlgorithm
source§fn cmp(&self, other: &CompressionAlgorithm) -> Ordering
fn cmp(&self, other: &CompressionAlgorithm) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for CompressionAlgorithm
impl PartialEq for CompressionAlgorithm
source§fn eq(&self, other: &CompressionAlgorithm) -> bool
fn eq(&self, other: &CompressionAlgorithm) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for CompressionAlgorithm
impl PartialOrd for CompressionAlgorithm
source§fn partial_cmp(&self, other: &CompressionAlgorithm) -> Option<Ordering>
fn partial_cmp(&self, other: &CompressionAlgorithm) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for CompressionAlgorithm
impl Eq for CompressionAlgorithm
impl StructuralPartialEq for CompressionAlgorithm
Auto Trait Implementations§
impl Freeze for CompressionAlgorithm
impl RefUnwindSafe for CompressionAlgorithm
impl Send for CompressionAlgorithm
impl Sync for CompressionAlgorithm
impl Unpin for CompressionAlgorithm
impl UnwindSafe for CompressionAlgorithm
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)