#[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
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
sourceimpl 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
sourceimpl Clone for CompressionAlgorithm
impl Clone for CompressionAlgorithm
sourcefn clone(&self) -> CompressionAlgorithm
fn clone(&self) -> CompressionAlgorithm
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CompressionAlgorithm
impl Debug for CompressionAlgorithm
sourceimpl Default for CompressionAlgorithm
impl Default for CompressionAlgorithm
sourceimpl Display for CompressionAlgorithm
impl Display for CompressionAlgorithm
sourceimpl From<CompressionAlgorithm> for u8
impl From<CompressionAlgorithm> for u8
sourcefn from(c: CompressionAlgorithm) -> u8
fn from(c: CompressionAlgorithm) -> u8
Converts to this type from the input type.
sourceimpl From<u8> for CompressionAlgorithm
impl From<u8> for CompressionAlgorithm
sourceimpl Hash for CompressionAlgorithm
impl Hash for CompressionAlgorithm
sourceimpl Ord for CompressionAlgorithm
impl Ord for CompressionAlgorithm
sourceimpl PartialEq<CompressionAlgorithm> for CompressionAlgorithm
impl PartialEq<CompressionAlgorithm> for CompressionAlgorithm
sourcefn 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 ==
. Read more
sourcefn ne(&self, other: &CompressionAlgorithm) -> bool
fn ne(&self, other: &CompressionAlgorithm) -> bool
This method tests for !=
.
sourceimpl PartialOrd<CompressionAlgorithm> for CompressionAlgorithm
impl PartialOrd<CompressionAlgorithm> for CompressionAlgorithm
sourcefn partial_cmp(&self, other: &CompressionAlgorithm) -> Option<Ordering>
fn partial_cmp(&self, other: &CompressionAlgorithm) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
impl Copy for CompressionAlgorithm
impl Eq for CompressionAlgorithm
impl StructuralEq for CompressionAlgorithm
impl StructuralPartialEq for CompressionAlgorithm
Auto Trait Implementations
impl RefUnwindSafe for CompressionAlgorithm
impl Send for CompressionAlgorithm
impl Sync for CompressionAlgorithm
impl Unpin for CompressionAlgorithm
impl UnwindSafe for CompressionAlgorithm
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more