Skip to content

Commit 5038225

Browse files
authored
Merge pull request #27 from dtolnay/result
Show example of anyhow::Result with two type parameters
2 parents 20fbcf3 + f7c0e7d commit 5038225

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/lib.rs

+14
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,20 @@ pub use crate::error::{Chain, Error};
192192
/// for `fn main`; if you do, failures will be printed along with any
193193
/// [context][Context] and a backtrace if one was captured.
194194
///
195+
/// `anyhow::Result` may be used with one *or* two type parameters.
196+
///
197+
/// ```rust
198+
/// use anyhow::Result;
199+
///
200+
/// # const IGNORE: &str = stringify! {
201+
/// fn demo1() -> Result<T> {...}
202+
/// // ^ equivalent to std::result::Result<T, anyhow::Error>
203+
///
204+
/// fn demo2() -> Result<T, OtherError> {...}
205+
/// // ^ equivalent to std::result::Result<T, OtherError>
206+
/// # };
207+
/// ```
208+
///
195209
/// # Example
196210
///
197211
/// ```

0 commit comments

Comments
 (0)