pub type Result<T, C> = Result<T, Report<C>>;Expand description
A reasonable return type to use throughout an application.
The Result type can be used with one or two parameters, where the first parameter represents
the Ok arm and the second parameter Context is used as in Report<C>.
§Examples
Result can also be used in fn main():
use error_stack::{ensure, Result};
fn main() -> Result<(), AccessError> {
let user = get_user()?;
let resource = get_resource()?;
ensure!(
has_permission(user, resource),
AccessError::PermissionDenied(user, resource)
);
...
}Aliased Type§
enum Result<T, C> {
Ok(T),
Err(Report<C>),
}