pub trait MapErrorToTestFailure<T> {
    fn err_to_test_failure(self) -> Result<T>;
}
Expand description

Adds to Result support for ergonomically mapping the Err variant to a [TestAssertionFailure].

Required Methods§

Converts the Err variant of a Result to a [TestAssertionFailure].

This allows the use of the ? operator with any supported Result inside a test or other function returning Result. For example:

fn test_something() -> Result<()> {
    let output =
        std::process::Command("do_something").output()
            .err_to_test_failure()?;
}

The current implementation requires that the Err variant of the Result implement std::fmt::Display.

Implementations on Foreign Types§

Implementors§