summaryrefslogtreecommitdiffstats
path: root/openpgp/src/keyid.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-03 12:24:29 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-03 12:36:04 +0200
commit7b9035fac61467482de683f890eb3c9971e955db (patch)
tree584024194ded707adaf620af6fc817ba39b93294 /openpgp/src/keyid.rs
parent7901c7ee84e7863c5227ded5f29a36beddbcecb8 (diff)
openpgp: Assert that central types are Send and Sync.
- Add compile-time assertions that public types like Packet, TPK, Message... can be send across thread boundaries, and can be safely accessed from multiple threads. - Fixes #334.
Diffstat (limited to 'openpgp/src/keyid.rs')
-rw-r--r--openpgp/src/keyid.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/openpgp/src/keyid.rs b/openpgp/src/keyid.rs
index 2e77c962..275599f9 100644
--- a/openpgp/src/keyid.rs
+++ b/openpgp/src/keyid.rs
@@ -215,4 +215,10 @@ mod test {
assert_match!(KeyID::Invalid(_) =
KeyID::from_hex("0x587DAEF1").unwrap());
}
+
+ #[test]
+ fn keyid_is_send_and_sync() {
+ fn f<T: Send + Sync>(_: T) {}
+ f(KeyID::from_hex("89AB CDEF 0123 4567").unwrap());
+ }
}