Trait AssertResult

Source
pub trait AssertResult {
    // Required methods
    fn is_ok(self) -> Self;
    fn is_err(self) -> Self;
}
Expand description

Assert whether a subject of the Result type holds some value or an error.

§Examples

use asserting::prelude::*;

let subject: Result<f64, String> = Ok(-3.14);
assert_that!(subject).is_ok();

let subject: Result<(), String> = Err("consequat sanctus ea exercitation".to_string());
assert_that!(subject).is_err();

Required Methods§

Source

fn is_ok(self) -> Self

Verifies that the subject has an ok value.

Source

fn is_err(self) -> Self

Verifies that the subject has an err value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, E, R> AssertResult for Spec<'_, Result<T, E>, R>
where T: Debug, E: Debug, R: FailingStrategy,