pub trait OnFailure<FailureClass> {
    // Required method
    fn on_failure(
        &mut self,
        failure_classification: FailureClass,
        latency: Duration,
        span: &Span
    );
}
Available on crate feature trace only.
Expand description

Trait used to tell Trace what to do when a request fails.

See the module docs for details on exactly when the on_failure callback is called.

Required Methods§

source

fn on_failure( &mut self, failure_classification: FailureClass, latency: Duration, span: &Span )

Do the thing.

latency is the duration since the request was received.

span is the tracing Span, corresponding to this request, produced by the closure passed to TraceLayer::make_span_with. It can be used to record field values that weren’t known when the span was created.

Implementations on Foreign Types§

source§

impl<FailureClass> OnFailure<FailureClass> for ()

source§

fn on_failure(&mut self, _: FailureClass, _: Duration, _: &Span)

Implementors§

source§

impl<F, FailureClass> OnFailure<FailureClass> for Fwhere F: FnMut(FailureClass, Duration, &Span),

source§

impl<FailureClass> OnFailure<FailureClass> for DefaultOnFailurewhere FailureClass: Display,