Skip to main content

ErrorSink

Trait ErrorSink 

pub trait ErrorSink<E = Box<dyn Error + Sync + Send>>:
    Send
    + Sync
    + 'static {
    // Required method
    fn sink_error(&self, error: E);
}
Expand description

A sink for errors produced in fire-and-forget contexts where the error cannot be propagated back to a caller.

Implemented for any Fn(E) + Send + Sync + 'static, and by the provided TracingErrorSink. Use it as a trait object (Arc<dyn ErrorSink>) when the sink is configurable at runtime.

Required Methods§

fn sink_error(&self, error: E)

Consume (observe and/or route) an error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl<E, F> ErrorSink<E> for F
where F: Fn(E) + Send + Sync + 'static,

§

impl<E, T> ErrorSink<E> for Arc<T>
where T: ErrorSink<E> + ?Sized,

A shared (ref-counted) sink is itself an ErrorSink, so an Arc<dyn ErrorSink> can be handed around and reused.

§

impl<E> ErrorSink<E> for DropErrorSink

§

impl<E> ErrorSink<E> for TracingErrorSink
where E: Into<Box<dyn Error + Sync + Send>>,