Ignore

Trait Ignore 

Source
pub trait Ignore: Sized {
    // Provided method
    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§

Source

fn ignore(self)

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.

Implementations on Foreign Types§

Source§

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

Implementors§