Skip to main content

ErrorRegistryExt

Trait ErrorRegistryExt 

Source
pub trait ErrorRegistryExt<T, E>: Sized {
    // Required method
    fn unwrap_or_record_with<F>(self, default: T, on_error: F) -> T
       where F: FnOnce() -> E,
             E: Send + 'static;
}
Expand description

Result extension for recording an error before returning a fallback value.

This operation uses ordinary branching on the Result discriminant. It is intended for diagnostics and must not be used when the success/failure state itself is secret.

Required Methods§

Source

fn unwrap_or_record_with<F>(self, default: T, on_error: F) -> T
where F: FnOnce() -> E, E: Send + 'static,

Return the successful value, or record on_error() and return default.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

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

Source§

fn unwrap_or_record_with<F>(self, default: T, on_error: F) -> T
where F: FnOnce() -> E, E: Send + 'static,

Implementors§