rama::http::layer::trace

Trait OnRequest

pub trait OnRequest<B>:
    Send
    + Sync
    + 'static {
    // Required method
    fn on_request(&self, request: &Request<B>, span: &Span);
}
Expand description

Trait used to tell Trace what to do when a request is received.

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

Required Methods§

fn on_request(&self, request: &Request<B>, span: &Span)

Do the thing.

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§

§

impl<B> OnRequest<B> for ()

§

fn on_request(&self, _: &Request<B>, _: &Span)

Implementors§

§

impl<B> OnRequest<B> for DefaultOnRequest

§

impl<B, F> OnRequest<B> for F
where F: Fn(&Request<B>, &Span) + Send + Sync + 'static,