1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::OptionExt;
use core::fmt::{Debug, Display};

impl<T> OptionExt<T> for Option<T> {
    #[track_caller]
    fn ok_or_eyre<M>(self, message: M) -> crate::Result<T>
    where
        M: Debug + Display + Send + Sync + 'static,
    {
        match self {
            Some(ok) => Ok(ok),
            None => Err(crate::Report::msg(message)),
        }
    }
}