Trait ignore_result::Ignore

source ·
pub trait Ignore: Sized {
    fn ignore(self) { ... }
}
Expand description

The Ignore trait is used to consume the result of a function call in cases where a function’s success or failure is irrelevant, i.e. in “best effort” scenarios. By consuming the original Result and swallowing its Ok() result, it guarantees correctness.

A call to Ignore::ignore() avoids compiler warnings about unused results, without requiring a possibly unsafe call to .unwrap() if the success of the preceding function call is not guaranteed.

Provided Methods§

Implementations on Foreign Types§

Implementors§