Skip to main content

OnEos

Trait OnEos 

pub trait OnEos:
    Send
    + Sync
    + 'static {
    // Required method
    fn on_eos(
        self,
        trailers: Option<&HeaderMap>,
        stream_duration: Duration,
        span: &Span,
    );
}
Available on crate feature http only.
Expand description

Trait used to tell Trace what to do when a stream closes.

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

Required Methods§

fn on_eos( self, trailers: Option<&HeaderMap>, stream_duration: Duration, span: &Span, )

Do the thing.

stream_duration is the duration since the response was sent.

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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

§

impl OnEos for ()

§

fn on_eos(self, _: Option<&HeaderMap>, _: Duration, _: &Span)

Implementors§

§

impl OnEos for DefaultOnEos

§

impl<F> OnEos for F
where F: Fn(Option<&HeaderMap>, Duration, &Span) + Send + Sync + 'static,