summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8412e2a..faae525 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,8 +10,8 @@
//! so much time handling unexpected errors. That's what this crate is for. You
//! keep your unexpected errors, and don't worry about them until later.
//!
-//! * This crate works in `no-std`, although most features (besides [`Exun`]) require
-//! `alloc`.
+//! * This crate works in `no-std`. Some extra features come if `alloc` or `std` is
+//! used.
//!
//! * [`Exun`] is an error type. It'll hold on to your [`Unexpected`] error if you have
//! one, so you can figure out what to do with it later. If the error is
@@ -36,7 +36,7 @@
//! ```toml
//! [dependencies]
//! # ...
-//! exun = "0.1"
+//! exun = "0.2"
//! ```
//!
//! The following features are enabled by default:
@@ -46,15 +46,16 @@
//! into [`Exun`] and [`RawUnexpected`] errors automatically, and it's needed for
//! [`Result::unexpect`].
//!
-//! * `alloc`: This is needed for [`Expect`], [`RawUnexpected`] and
-//! [`UnexpectedError`], as well as [`Result::unexpect_msg`].
+//! * `alloc`: This is needed for `RawUnexpected` and `UnexpectedError` to hold
+//! string messages. This can be done with `Result::unexpect_mshg`. Without this,
+//! only the equivalent of `Result::unexpect_none` can be constructed.
//!
//! To disable these features:
//!
//! ```toml
//! [dependencies]
//! # ...
-//! exun = { version = "0.1", default-features = false }
+//! exun = { version = "0.2", default-features = false }
//! ```
//!
//! If you'd like to use `alloc` but not `std`:
@@ -62,7 +63,7 @@
//! ```toml
//! [dependencies]
//! # ...
-//! exun = { version = "0.1", default-features = false, features = ["alloc"] }
+//! exun = { version = "0.2", default-features = false, features = ["alloc"] }
//! ```
//!
//! ## Examples
@@ -78,6 +79,16 @@
//! }
//! ```
//!
+//! ```rust
+//! use exun::*;
+//!
+//! fn first(list: &[i32]) -> Result<i32, RawUnexpected> {
+//! // for options, the `unexpect_none` method can be used
+//! let num = list.get(0).unexpect_none()?;
+//! Ok(num)
+//! }
+//! ```
+//!
//! ```
//! use std::error::Error;
//! use std::fmt::{self, Display};