diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2020-05-06 14:38:33 +0200 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2020-06-01 15:30:15 +0200 |
commit | ebb719dcc6c0a719cab77f4fb7e296e8efe85f13 (patch) | |
tree | 959664d259f3d57396086c8c78907297130e983e /openpgp/src/types/server_preferences.rs | |
parent | 09f30c446541acee77f18d365cbdbb970dd82543 (diff) |
openpgp: Add doctests to types module.
- Fixes #475.
Diffstat (limited to 'openpgp/src/types/server_preferences.rs')
-rw-r--r-- | openpgp/src/types/server_preferences.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/openpgp/src/types/server_preferences.rs b/openpgp/src/types/server_preferences.rs index d6a0b7f2..f0b38f7e 100644 --- a/openpgp/src/types/server_preferences.rs +++ b/openpgp/src/types/server_preferences.rs @@ -4,10 +4,44 @@ use quickcheck::{Arbitrary, Gen}; /// Describes preferences regarding key servers. /// +/// Key server preferences are specified in [Section 5.2.3.17 of RFC 4880] and +/// [Section 5.2.3.18 of RFC 4880bis]. +/// +/// [Section 5.2.3.17 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.2.3.17 +/// [Section 5.2.3.18 of RFC 4880bis]: https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-09#section-5.2.3.18 +/// /// # A note on equality /// /// `PartialEq` is implements semantic equality, i.e. it ignores /// padding. +/// +/// # Examples +/// +/// ``` +/// use sequoia_openpgp as openpgp; +/// # use openpgp::Result; +/// use openpgp::cert::prelude::*; +/// use openpgp::policy::StandardPolicy; +/// +/// # fn main() -> Result<()> { +/// let p = &StandardPolicy::new(); +/// +/// let (cert, _) = +/// CertBuilder::general_purpose(None, Some("alice@example.org")) +/// .generate()?; +/// +/// match cert.with_policy(p, None)?.primary_userid()?.key_server_preferences() { +/// Some(preferences) => { +/// println!("Certificate holder's keyserver preferences:"); +/// assert!(preferences.no_modify()); +/// # unreachable!(); +/// } +/// None => { +/// println!("Certificate Holder did not specify any key server preferences."); +/// } +/// } +/// # Ok(()) } +/// ``` #[derive(Clone)] pub struct KeyServerPreferences{ no_modify: bool, |