summaryrefslogtreecommitdiffstats
path: root/openpgp/src/types
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2020-12-04 20:06:17 +0100
committerAzul <azul@riseup.net>2020-12-08 10:35:58 +0100
commitb956d36cb50cac28aa9da0e373fb33c9a4c120af (patch)
treec20bb42230aed97494b6abe494bc8e22053f58a6 /openpgp/src/types
parent4a971af5abe70d41485df141a3d9fa97eaab5f1c (diff)
openpgp: Ensure public types are Send and Sync.
- See #627.
Diffstat (limited to 'openpgp/src/types')
-rw-r--r--openpgp/src/types/compression_level.rs1
-rw-r--r--openpgp/src/types/features.rs1
-rw-r--r--openpgp/src/types/key_flags.rs1
-rw-r--r--openpgp/src/types/mod.rs3
-rw-r--r--openpgp/src/types/server_preferences.rs1
-rw-r--r--openpgp/src/types/timestamp.rs2
6 files changed, 9 insertions, 0 deletions
diff --git a/openpgp/src/types/compression_level.rs b/openpgp/src/types/compression_level.rs
index 069d2bd4..b414ef74 100644
--- a/openpgp/src/types/compression_level.rs
+++ b/openpgp/src/types/compression_level.rs
@@ -50,6 +50,7 @@ use crate::{
/// ```
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CompressionLevel(u8);
+assert_send_and_sync!{CompressionLevel}
impl Default for CompressionLevel {
fn default() -> Self {
diff --git a/openpgp/src/types/features.rs b/openpgp/src/types/features.rs
index 948a5cb0..4d15766c 100644
--- a/openpgp/src/types/features.rs
+++ b/openpgp/src/types/features.rs
@@ -55,6 +55,7 @@ use crate::types::Bitfield;
/// ```
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Features(Bitfield);
+assert_send_and_sync!{Features}
impl fmt::Debug for Features {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
diff --git a/openpgp/src/types/key_flags.rs b/openpgp/src/types/key_flags.rs
index cca9ac92..24583114 100644
--- a/openpgp/src/types/key_flags.rs
+++ b/openpgp/src/types/key_flags.rs
@@ -49,6 +49,7 @@ use crate::types::Bitfield;
/// ```
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct KeyFlags(Bitfield);
+assert_send_and_sync!{KeyFlags}
impl fmt::Debug for KeyFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs
index 4fd25e50..630cbd9a 100644
--- a/openpgp/src/types/mod.rs
+++ b/openpgp/src/types/mod.rs
@@ -71,6 +71,9 @@ mod timestamp;
pub use timestamp::{Timestamp, Duration};
pub(crate) use timestamp::normalize_systemtime;
+pub(crate) trait Sendable : Send {}
+pub(crate) trait Syncable : Sync {}
+
/// The OpenPGP public key algorithms as defined in [Section 9.1 of
/// RFC 4880], and [Section 5 of RFC 6637].
///
diff --git a/openpgp/src/types/server_preferences.rs b/openpgp/src/types/server_preferences.rs
index fdac56fc..06813b37 100644
--- a/openpgp/src/types/server_preferences.rs
+++ b/openpgp/src/types/server_preferences.rs
@@ -56,6 +56,7 @@ use crate::types::Bitfield;
/// ```
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct KeyServerPreferences(Bitfield);
+assert_send_and_sync!{KeyServerPreferences}
impl fmt::Debug for KeyServerPreferences {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs
index 33518df7..c34ff1cd 100644
--- a/openpgp/src/types/timestamp.rs
+++ b/openpgp/src/types/timestamp.rs
@@ -63,6 +63,7 @@ use crate::{
/// [`Timestamp::round_down`]: ../types/struct.Timestamp.html#method.round_down
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Timestamp(u32);
+assert_send_and_sync!{Timestamp}
impl From<Timestamp> for u32 {
fn from(t: Timestamp) -> Self {
@@ -280,6 +281,7 @@ impl Arbitrary for Timestamp {
/// ```
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Duration(u32);
+assert_send_and_sync!{Duration}
impl From<Duration> for u32 {
fn from(d: Duration) -> Self {