diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-02-21 11:23:07 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-02-21 11:23:07 +0100 |
commit | b79a4c48c3bb28f13c6cc8287952085a7c27e87f (patch) | |
tree | 55cdfd9897e182037aaf1cf90825d11641004c68 /openpgp/src/types | |
parent | 1017409d3473ac8c73676d916e91f3c02f539a00 (diff) |
openpgp: Mark enum SymmetricAlgorithm as non-exhaustive.
Diffstat (limited to 'openpgp/src/types')
-rw-r--r-- | openpgp/src/types/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs index 51b7273d..7a4c7451 100644 --- a/openpgp/src/types/mod.rs +++ b/openpgp/src/types/mod.rs @@ -399,6 +399,10 @@ pub enum SymmetricAlgorithm { Private(u8), /// Unknown algorithm identifier. Unknown(u8), + + /// This marks this enum as non-exhaustive. Do not use this + /// variant. + #[doc(hidden)] __Nonexhaustive, } impl Default for SymmetricAlgorithm { @@ -417,6 +421,7 @@ impl SymmetricAlgorithm { => true, Unencrypted | IDEA | Private(_) | Unknown(_) => false, + __Nonexhaustive => unreachable!(), } } } @@ -459,6 +464,7 @@ impl From<SymmetricAlgorithm> for u8 { SymmetricAlgorithm::Camellia256 => 13, SymmetricAlgorithm::Private(u) => u, SymmetricAlgorithm::Unknown(u) => u, + SymmetricAlgorithm::__Nonexhaustive => unreachable!(), } } } @@ -494,6 +500,7 @@ impl fmt::Display for SymmetricAlgorithm { f.write_fmt(format_args!("Private/Experimental symmetric key algorithm {}", u)), SymmetricAlgorithm::Unknown(u) => f.write_fmt(format_args!("Unknown symmetric key algorithm {}", u)), + SymmetricAlgorithm::__Nonexhaustive => unreachable!(), } } } |