Skip to main content

IsErrOr

Trait IsErrOr 

Source
pub trait IsErrOr<T> {
    // Required method
    fn is_err_or<F: FnOnce(T) -> bool>(self, f: F) -> bool;
}
Expand description

Tests whether a result is an error or its success value matches a predicate.

Every Err result returns true without exposing the error. An Ok result is consumed and passed to the predicate.

Required Methods§

Source

fn is_err_or<F: FnOnce(T) -> bool>(self, f: F) -> bool

Returns true for any error or a matching success value.

The predicate is called only for the Ok branch. Both the success value and any error are consumed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, E> IsErrOr<T> for Result<T, E>