Show example of anyhow::Result with two type parameters

This commit is contained in:
David Tolnay 2019-10-19 09:07:52 -04:00
parent 20fbcf3168
commit f7c0e7dbf9
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -192,6 +192,20 @@ pub use crate::error::{Chain, Error};
/// for `fn main`; if you do, failures will be printed along with any
/// [context][Context] and a backtrace if one was captured.
///
/// `anyhow::Result` may be used with one *or* two type parameters.
///
/// ```rust
/// use anyhow::Result;
///
/// # const IGNORE: &str = stringify! {
/// fn demo1() -> Result<T> {...}
/// // ^ equivalent to std::result::Result<T, anyhow::Error>
///
/// fn demo2() -> Result<T, OtherError> {...}
/// // ^ equivalent to std::result::Result<T, OtherError>
/// # };
/// ```
///
/// # Example
///
/// ```