diff options
author | Justus Winter <justus@pep-project.org> | 2018-01-03 12:09:48 +0100 |
---|---|---|
committer | Justus Winter <justus@pep-project.org> | 2018-01-03 14:39:28 +0100 |
commit | edbf086f09af6bafa46e794cf35d5dd95f3ceb53 (patch) | |
tree | 58748e85098062491042a7251b4fee1dd2915393 /core | |
parent | 06371dfab814b8755974868fac4f4cc2283294fe (diff) |
core,net: Avoid 'unwrap()' in examples.
- We should not even suggest to use unwrap in our examples.
Diffstat (limited to 'core')
-rw-r--r-- | core/src/lib.rs | 24 |
1 files changed, 18 insertions, 6 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); |