diff options
author | Azul <azul@riseup.net> | 2020-12-04 20:06:17 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2020-12-08 10:35:58 +0100 |
commit | b956d36cb50cac28aa9da0e373fb33c9a4c120af (patch) | |
tree | c20bb42230aed97494b6abe494bc8e22053f58a6 /openpgp/src/packet/mod.rs | |
parent | 4a971af5abe70d41485df141a3d9fa97eaab5f1c (diff) |
openpgp: Ensure public types are Send and Sync.
- See #627.
Diffstat (limited to 'openpgp/src/packet/mod.rs')
-rw-r--r-- | openpgp/src/packet/mod.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/openpgp/src/packet/mod.rs b/openpgp/src/packet/mod.rs index 93538a7e..62123105 100644 --- a/openpgp/src/packet/mod.rs +++ b/openpgp/src/packet/mod.rs @@ -284,6 +284,7 @@ pub enum Packet { AED(AED), } } // doc-hack, see above +assert_send_and_sync!{Packet} macro_rules! impl_into_iterator { ($t:ty) => { @@ -519,6 +520,7 @@ pub struct Common { /// this structure actually gains some fields. dummy: std::marker::PhantomData<()>, } +assert_send_and_sync!{Common} #[cfg(test)] impl Arbitrary for Common { @@ -597,6 +599,7 @@ pub struct Iter<'a> { // `paths` iter. depth: usize, } +assert_send_and_sync!{Iter<'a>, 'a} impl<'a> Default for Iter<'a> { fn default() -> Self { @@ -917,6 +920,7 @@ pub enum Signature { /// Signature packet version 4. V4(self::signature::Signature4), } +assert_send_and_sync!{Signature} impl Signature { /// Gets the version. @@ -974,6 +978,7 @@ pub enum OnePassSig { /// OnePassSig packet version 3. V3(self::one_pass_sig::OnePassSig3), } +assert_send_and_sync!{OnePassSig} impl OnePassSig { /// Gets the version. @@ -1035,6 +1040,7 @@ pub enum PKESK { /// PKESK packet version 3. V3(self::pkesk::PKESK3), } +assert_send_and_sync!{PKESK} impl PKESK { /// Gets the version. @@ -1100,6 +1106,7 @@ pub enum SKESK { /// This feature is [experimental](../index.html#experimental-features). V5(self::skesk::SKESK5), } +assert_send_and_sync!{SKESK} impl SKESK { /// Gets the version. @@ -1431,6 +1438,7 @@ pub enum Key<P: key::KeyParts, R: key::KeyRole> { /// A version 4 `Key` packet. V4(Key4<P, R>), } +assert_send_and_sync!{Key<key::PublicParts, key::UnspecifiedRole>} impl<P: key::KeyParts, R: key::KeyRole> fmt::Display for Key<P, R> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1810,6 +1818,7 @@ pub enum SEIP { /// SEIP packet version 1. V1(self::seip::SEIP1), } +assert_send_and_sync!{SEIP} impl SEIP { /// Gets the version. @@ -1871,6 +1880,7 @@ pub enum AED { /// AED packet version 1. V1(self::aed::AED1), } +assert_send_and_sync!{AED} impl AED { /// Gets the version. @@ -1913,12 +1923,6 @@ mod test { use crate::serialize::SerializeInto; use crate::parse::Parse; - #[test] - fn packet_is_send_and_sync() { - fn f<T: Send + Sync>(_: T) {} - f(Packet::Marker(Default::default())); - } - quickcheck! { fn roundtrip(p: Packet) -> bool { let buf = p.to_vec().expect("Failed to serialize packet"); |