summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-08-26 14:48:12 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-08-26 16:00:49 +0200
commit86e2cb5263a23fe78a49163f0e798efc349ca89e (patch)
tree070167129b99a3b7f5642ccbe84ee36b7a7d31d2 /store
parent86806951896d44a40b30ad4b10d2ea87c6140e45 (diff)
openpgp: Implement FromStr for some types.
- This implements std::str::FromStr for types that have string-representations and are reasonably likely to be encountered by downstream users, e.g. fingerprints or messages. This allows us to do `"xxx".parse()?`. - Fixes #320.
Diffstat (limited to 'store')
-rw-r--r--store/src/lib.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/store/src/lib.rs b/store/src/lib.rs
index 2dd00361..54fc8661 100644
--- a/store/src/lib.rs
+++ b/store/src/lib.rs
@@ -251,19 +251,19 @@ impl Pool {
/// Pool::import(&ctx, &tpk)?;
///
/// // Lookup by the primary key's KeyID.
- /// let key = Pool::lookup_by_subkeyid(&ctx, &KeyID::from_hex("AACB3243630052D9")?)?;
+ /// let key = Pool::lookup_by_subkeyid(&ctx, &"AACB3243630052D9".parse()?)?;
/// assert_eq!(key.tpk()?.fingerprint(), tpk.fingerprint());
///
/// // Lookup by the signing subkey's KeyID.
- /// let key = Pool::lookup_by_subkeyid(&ctx, &KeyID::from_hex("7223B56678E02528")?)?;
+ /// let key = Pool::lookup_by_subkeyid(&ctx, &"7223B56678E02528".parse()?)?;
/// assert_eq!(key.tpk()?.fingerprint(), tpk.fingerprint());
///
/// // Lookup by the encryption subkey's KeyID.
- /// let key = Pool::lookup_by_subkeyid(&ctx, &KeyID::from_hex("C2B819056C652598")?)?;
+ /// let key = Pool::lookup_by_subkeyid(&ctx, &"C2B819056C652598".parse()?)?;
/// assert_eq!(key.tpk()?.fingerprint(), tpk.fingerprint());
///
/// // Lookup by the authentication subkey's KeyID.
- /// let key = Pool::lookup_by_subkeyid(&ctx, &KeyID::from_hex("A3506AFB820ABD08")?)?;
+ /// let key = Pool::lookup_by_subkeyid(&ctx, &"A3506AFB820ABD08".parse()?)?;
/// assert_eq!(key.tpk()?.fingerprint(), tpk.fingerprint());
/// # Ok(())
/// # }
@@ -490,12 +490,12 @@ impl Store {
/// store.import("Emmelie", &tpk)?;
///
/// // Lookup by the primary key's KeyID.
- /// let tpk_ = store.lookup_by_subkeyid(&KeyID::from_hex("069C0C348DD82C19")?)?
+ /// let tpk_ = store.lookup_by_subkeyid(&"069C0C348DD82C19".parse()?)?
/// .tpk()?;
/// assert_eq!(tpk, tpk_);
///
/// // Lookup by the subkey's KeyID.
- /// let tpk_ = store.lookup_by_subkeyid(&KeyID::from_hex("22E3FAFE96B56C32")?)?
+ /// let tpk_ = store.lookup_by_subkeyid(&"22E3FAFE96B56C32".parse()?)?
/// .tpk()?;
/// assert_eq!(tpk, tpk_);
/// # Ok(())