summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/lib.rs24
-rw-r--r--net/src/lib.rs10
2 files changed, 24 insertions, 10 deletions
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 274725c3..1ef2cf54 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -13,18 +13,26 @@ use std::path::{Path, PathBuf};
/// `Context::new`:
///
/// ```
-/// # use sequoia_core::Context;
-/// let c = Context::new("org.example.webmail").unwrap();
+/// # use sequoia_core::{Context, Result};
+/// # f().unwrap();
+/// # fn f() -> Result<()> {
+/// let c = Context::new("org.example.webmail")?;
+/// # Ok(())
+/// # }
/// ```
///
/// A context can be configured using the builder pattern with
/// `Context::configure`:
///
/// ```
-/// # use sequoia_core::{Context, NetworkPolicy};
+/// # use sequoia_core::{Context, NetworkPolicy, Result};
+/// # f().unwrap();
+/// # fn f() -> Result<()> {
/// let c = Context::configure("org.example.webmail")
/// .network_policy(NetworkPolicy::Offline)
-/// .build().unwrap();
+/// .build()?;
+/// # Ok(())
+/// # }
/// ```
pub struct Context {
domain: String,
@@ -96,10 +104,14 @@ impl Context {
/// `Context::configure`:
///
/// ```
-/// # use sequoia_core::{Context, NetworkPolicy};
+/// # use sequoia_core::{Context, NetworkPolicy, Result};
+/// # f().unwrap();
+/// # fn f() -> Result<()> {
/// let c = Context::configure("org.example.webmail")
/// .network_policy(NetworkPolicy::Offline)
-/// .build().unwrap();
+/// .build()?;
+/// # Ok(())
+/// # }
/// ```
pub struct Config(Context);
diff --git a/net/src/lib.rs b/net/src/lib.rs
index 2537fee8..bab1b8ff 100644
--- a/net/src/lib.rs
+++ b/net/src/lib.rs
@@ -19,12 +19,14 @@
//! # extern crate sequoia_net;
//! # use openpgp::types::KeyId;
//! # use sequoia_core::Context;
-//! # use sequoia_net::KeyServer;
-//! # fn main() {
-//! let ctx = Context::new("org.sequoia-pgp.example").unwrap();
-//! let mut ks = KeyServer::sks_pool(&ctx).unwrap();
+//! # use sequoia_net::{KeyServer, Result};
+//! # fn main() { f().unwrap(); }
+//! # fn f() -> Result<()> {
+//! let ctx = Context::new("org.sequoia-pgp.example")?;
+//! let mut ks = KeyServer::sks_pool(&ctx)?;
//! let keyid = KeyId::from_hex("31855247603831FD").unwrap();
//! println!("{:?}", ks.get(&keyid));
+//! Ok(())
//! # }
//! ```