Trait errata::FallibleExt
source · pub trait FallibleExt<T> {
// Required method
fn fail(self, msg: impl Display) -> T;
}Expand description
The trait providing fail.
Implemented for Option<T> and Result<T, E: Display>.
Required Methods§
sourcefn fail(self, msg: impl Display) -> T
fn fail(self, msg: impl Display) -> T
Exits the program cleanly, calling destructors and printing an error message.
If you enable feature color, prints in bold red.
Usage:
let bad: Option<i32> = None;
// Prints the text verbatim to stderr, then exits with code 1.
bad.fail("Expected bad to contain a value");Object Safety§
This trait is not object safe.