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

Wrap the contained Err in CriticalError or leave Ok untouched

Implementations on Foreign Types

Implementors