diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-09-03 12:24:29 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-09-03 12:36:04 +0200 |
commit | 7b9035fac61467482de683f890eb3c9971e955db (patch) | |
tree | 584024194ded707adaf620af6fc817ba39b93294 /openpgp/src/fingerprint.rs | |
parent | 7901c7ee84e7863c5227ded5f29a36beddbcecb8 (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/fingerprint.rs')
-rw-r--r-- | openpgp/src/fingerprint.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/openpgp/src/fingerprint.rs b/openpgp/src/fingerprint.rs index a12ec118..309313be 100644 --- a/openpgp/src/fingerprint.rs +++ b/openpgp/src/fingerprint.rs @@ -191,4 +191,11 @@ Charlie Delta Echo Foxtrot Zero One Two Three Four Five Six Seven"; assert_eq!(fpr.to_icao(), expected); } + + #[test] + fn fingerprint_is_send_and_sync() { + fn f<T: Send + Sync>(_: T) {} + f(Fingerprint::from_hex( + "0123 4567 89AB CDEF 0123 4567 89AB CDEF 0123 4567").unwrap()); + } } |