eyre/
option.rs

1use crate::OptionExt;
2use core::fmt::{Debug, Display};
3
4impl<T> OptionExt<T> for Option<T> {
5    #[track_caller]
6    fn ok_or_eyre<M>(self, message: M) -> crate::Result<T>
7    where
8        M: Debug + Display + Send + Sync + 'static,
9    {
10        match self {
11            Some(ok) => Ok(ok),
12            None => Err(crate::Report::msg(message)),
13        }
14    }
15}