Trait easy_repl::command::Critical [−][src]
pub trait Critical<T, E> {
fn into_critical(self) -> Result<T, CriticalError>;
}Expand description
Extension trait to easily wrap errors in CriticalError.
This is implemented for std::result::Result so can be used to coveniently
wrap errors that implement std::error::Error to indicate that they are
critical and should be returned by the REPL, for example:
let result: Result<(), std::fmt::Error> = Err(std::fmt::Error); let critical = result.into_critical(); assert!(matches!(critical, Err(CriticalError::Critical(_))));
See examples/errors.rs for a concrete usage example.
Required methods
fn into_critical(self) -> Result<T, CriticalError>[src]
Expand description
Wrap the contained Err in CriticalError or leave Ok untouched
Implementations on Foreign Types
impl<T, E> Critical<T, E> for Result<T, E> where
E: Error + Send + Sync + 'static, [src]
impl<T, E> Critical<T, E> for Result<T, E> where
E: Error + Send + Sync + 'static, [src]