From 2164d2e3db8c66ab98164465eaf821eb7765a760 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Thu, 20 Feb 2020 13:26:01 +0100 Subject: openpgp: Rename the Amalgamation trait to ValidAmalgamation. - The Amalgamation trait only applies to ValidComponents. Rename it accordingly. --- autocrypt/src/lib.rs | 2 +- openpgp-ffi/src/cert.rs | 2 +- openpgp-ffi/src/parse/stream.rs | 2 +- openpgp/src/cert/amalgamation.rs | 4 ++-- openpgp/src/cert/builder.rs | 2 +- openpgp/src/cert/component_iter.rs | 4 ++-- openpgp/src/cert/components.rs | 2 +- openpgp/src/cert/key_amalgamation.rs | 7 ++++--- openpgp/src/cert/keyiter.rs | 4 ++-- openpgp/src/cert/mod.rs | 6 +++--- openpgp/src/cert/revoke.rs | 4 ++-- openpgp/src/parse/stream.rs | 2 +- openpgp/src/serialize/cert.rs | 2 +- tool/src/commands/inspect.rs | 2 +- 14 files changed, 23 insertions(+), 22 deletions(-) diff --git a/autocrypt/src/lib.rs b/autocrypt/src/lib.rs index f2aee4e9..f5f5988c 100644 --- a/autocrypt/src/lib.rs +++ b/autocrypt/src/lib.rs @@ -27,7 +27,7 @@ pub use openpgp::Result; use openpgp::Packet; use openpgp::packet::SKESK; use openpgp::Cert; -use openpgp::cert::components::Amalgamation; +use openpgp::cert::components::ValidAmalgamation; use openpgp::parse::{ Parse, PacketParserResult, PacketParser, diff --git a/openpgp-ffi/src/cert.rs b/openpgp-ffi/src/cert.rs index 0c4b2e83..988e958f 100644 --- a/openpgp-ffi/src/cert.rs +++ b/openpgp-ffi/src/cert.rs @@ -23,10 +23,10 @@ use self::openpgp::{ CertParser, CertRevocationBuilder, components::{ - Amalgamation, KeyIter, UserIDBundle, UserIDBundleIter, + ValidAmalgamation, ValidKeyIter, }, }, diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs index 6e549352..9c6a8de5 100644 --- a/openpgp-ffi/src/parse/stream.rs +++ b/openpgp-ffi/src/parse/stream.rs @@ -16,7 +16,7 @@ use libc::{c_int, c_void, time_t}; extern crate sequoia_openpgp as openpgp; use self::openpgp::{ - cert::components::Amalgamation, + cert::components::ValidAmalgamation, crypto::SessionKey, types::SymmetricAlgorithm, packet::{ diff --git a/openpgp/src/cert/amalgamation.rs b/openpgp/src/cert/amalgamation.rs index 5cd7e8b7..64f5adf3 100644 --- a/openpgp/src/cert/amalgamation.rs +++ b/openpgp/src/cert/amalgamation.rs @@ -200,7 +200,7 @@ impl<'a, C> ValidComponentAmalgamation<'a, C> } /// Represents a component under a given policy. -pub trait Amalgamation<'a> { +pub trait ValidAmalgamation<'a> { /// Returns the certificate that the component came from. fn cert(&self) -> &'a Cert; @@ -377,7 +377,7 @@ pub trait Amalgamation<'a> { } } -impl<'a, C> Amalgamation<'a> for ValidComponentAmalgamation<'a, C> { +impl<'a, C> ValidAmalgamation<'a> for ValidComponentAmalgamation<'a, C> { // NOTE: No docstring, because ComponentAmalgamation has the same method. // Returns the certificate that the component came from. fn cert(&self) -> &'a Cert { diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index a971c737..00676576 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -428,7 +428,7 @@ impl CertBuilder { #[cfg(test)] mod tests { use super::*; - use crate::cert::components::Amalgamation; + use crate::cert::components::ValidAmalgamation; use crate::packet::signature::subpacket::{SubpacketTag, SubpacketValue}; use crate::types::PublicKeyAlgorithm; use crate::policy::StandardPolicy as P; diff --git a/openpgp/src/cert/component_iter.rs b/openpgp/src/cert/component_iter.rs index 4776602d..ff844ac8 100644 --- a/openpgp/src/cert/component_iter.rs +++ b/openpgp/src/cert/component_iter.rs @@ -8,8 +8,8 @@ use crate::{ components::{ ComponentBundle, ComponentBundleIter, - Amalgamation, ComponentAmalgamation, + ValidAmalgamation, ValidComponentAmalgamation, }, }, @@ -182,7 +182,7 @@ impl<'a, C> ValidComponentIter<'a, C> { /// # use openpgp::Result; /// # use openpgp::cert::CertBuilder; /// use openpgp::types::RevocationStatus; - /// use openpgp::cert::components::Amalgamation; + /// use openpgp::cert::components::ValidAmalgamation; /// use sequoia_openpgp::policy::StandardPolicy; /// /// # fn main() { f().unwrap(); } diff --git a/openpgp/src/cert/components.rs b/openpgp/src/cert/components.rs index e8c94376..3965e65f 100644 --- a/openpgp/src/cert/components.rs +++ b/openpgp/src/cert/components.rs @@ -25,8 +25,8 @@ use super::{ canonical_signature_order, }; pub use super::amalgamation::{ - Amalgamation, ComponentAmalgamation, + ValidAmalgamation, ValidComponentAmalgamation, }; pub use super::key_amalgamation::{ diff --git a/openpgp/src/cert/key_amalgamation.rs b/openpgp/src/cert/key_amalgamation.rs index 6209ddce..f0e5c50b 100644 --- a/openpgp/src/cert/key_amalgamation.rs +++ b/openpgp/src/cert/key_amalgamation.rs @@ -7,8 +7,8 @@ use failure::ResultExt; use crate::{ Cert, cert::components::{ - Amalgamation, KeyBundle, + ValidAmalgamation, }, Error, packet::key, @@ -273,7 +273,8 @@ impl<'a, P: key::KeyParts> From> } } -impl<'a, P: 'a + key::KeyParts> Amalgamation<'a> for ValidKeyAmalgamation<'a, P> +impl<'a, P: 'a + key::KeyParts> ValidAmalgamation<'a> + for ValidKeyAmalgamation<'a, P> { // NOTE: No docstring, because KeyAmalgamation has the same method. // Returns the certificate that the component came from. @@ -451,7 +452,7 @@ impl<'a, P: key::KeyParts> ValidPrimaryKeyAmalgamation<'a, P> { } } -impl<'a, P: 'a + key::KeyParts> Amalgamation<'a> +impl<'a, P: 'a + key::KeyParts> ValidAmalgamation<'a> for ValidPrimaryKeyAmalgamation<'a, P> { // NOTE: No docstring, because KeyAmalgamation has the same method. diff --git a/openpgp/src/cert/keyiter.rs b/openpgp/src/cert/keyiter.rs index 8f6240eb..fd53e06b 100644 --- a/openpgp/src/cert/keyiter.rs +++ b/openpgp/src/cert/keyiter.rs @@ -12,9 +12,9 @@ use crate::{ cert::{ Cert, components::{ - Amalgamation, KeyBundle, UnfilteredKeyBundleIter, + ValidAmalgamation, }, KeyAmalgamation, ValidKeyAmalgamation, @@ -767,7 +767,7 @@ impl<'a, P: 'a + key::KeyParts> ValidKeyIter<'a, P> /// # use openpgp::Result; /// # use openpgp::cert::CertBuilder; /// use openpgp::types::RevocationStatus; - /// use openpgp::cert::components::Amalgamation; + /// use openpgp::cert::components::ValidAmalgamation; /// use sequoia_openpgp::policy::StandardPolicy; /// /// # fn main() { f().unwrap(); } diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index f34a2df7..988ef3fb 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -48,11 +48,11 @@ mod builder; mod bindings; pub mod components; use components::{ - Amalgamation, ComponentBundle, PrimaryKeyBundle, UnfilteredKeyBundleIter, UnknownBundleIter, + ValidAmalgamation, ValidComponentAmalgamation, }; mod component_iter; @@ -252,7 +252,7 @@ type UnknownBindings = ComponentBundles; /// on self signatures can be used to express preferences for /// algorithms and key management. Furthermore, the key holder's /// OpenPGP implementation can express its feature set. -pub trait Preferences<'a>: components::Amalgamation<'a> { +pub trait Preferences<'a>: components::ValidAmalgamation<'a> { /// Returns symmetric algorithms that the key holder prefers. /// /// The algorithms are ordered according by the key holder's @@ -1533,7 +1533,7 @@ impl<'a> CertAmalgamation<'a> { #[cfg(test)] mod test { use crate::serialize::Serialize; - use super::components::Amalgamation; + use super::components::ValidAmalgamation; use crate::policy::StandardPolicy as P; use crate::types::Curve; use super::*; diff --git a/openpgp/src/cert/revoke.rs b/openpgp/src/cert/revoke.rs index bf0f40ad..523e9a24 100644 --- a/openpgp/src/cert/revoke.rs +++ b/openpgp/src/cert/revoke.rs @@ -274,7 +274,7 @@ impl Deref for SubkeyRevocationBuilder { /// /// ``` /// # use sequoia_openpgp::{*, packet::*, types::*, cert::*}; -/// use sequoia_openpgp::cert::components::Amalgamation; +/// use sequoia_openpgp::cert::components::ValidAmalgamation; /// use sequoia_openpgp::policy::StandardPolicy; /// /// # f().unwrap(); @@ -391,7 +391,7 @@ impl Deref for UserIDRevocationBuilder { /// /// ``` /// # use sequoia_openpgp::{*, packet::*, types::*, cert::*}; -/// use sequoia_openpgp::cert::components::Amalgamation; +/// use sequoia_openpgp::cert::components::ValidAmalgamation; /// use sequoia_openpgp::policy::StandardPolicy; /// /// # f().unwrap(); diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 06fd231c..ceca3e3c 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -44,7 +44,7 @@ use crate::{ packet::Signature, Cert, cert::components::{ - Amalgamation, + ValidAmalgamation, ValidKeyAmalgamation, }, crypto::SessionKey, diff --git a/openpgp/src/serialize/cert.rs b/openpgp/src/serialize/cert.rs index d7c94ab7..a74ebc35 100644 --- a/openpgp/src/serialize/cert.rs +++ b/openpgp/src/serialize/cert.rs @@ -664,7 +664,7 @@ impl<'a> SerializeInto for TSK<'a> { mod test { use super::*; use crate::vec_truncate; - use crate::cert::components::Amalgamation; + use crate::cert::components::ValidAmalgamation; use crate::parse::Parse; use crate::serialize::Serialize; use crate::packet::key; diff --git a/tool/src/commands/inspect.rs b/tool/src/commands/inspect.rs index 3f8cd3bd..c0e038c6 100644 --- a/tool/src/commands/inspect.rs +++ b/tool/src/commands/inspect.rs @@ -4,7 +4,7 @@ use clap; extern crate sequoia_openpgp as openpgp; use crate::openpgp::{Packet, Result}; -use crate::openpgp::cert::components::Amalgamation; +use crate::openpgp::cert::components::ValidAmalgamation; use openpgp::packet::key::PublicParts; use crate::openpgp::parse::{Parse, PacketParserResult}; use crate::openpgp::policy::Policy; -- cgit v1.2.3