pub trait LayerContext:
Clone
+ Send
+ Sync {
const INSPECT_HEADERS: &'static [&'static HeaderName];
// Provided methods
fn extract_client_ip(&self, span: &Span, parts: &Parts) -> Option<IpAddr> { ... }
fn on_request<T>(&self, span: &Span, request: &Request<T>) { ... }
fn on_response_ok<T>(&self, span: &Span, response: &mut Response<T>) { ... }
fn on_response_error(&self, span: &Span, error: &impl Error) { ... }
}Expand description
HttpRequestLayer context interface
Required Associated Constants§
Sourceconst INSPECT_HEADERS: &'static [&'static HeaderName]
const INSPECT_HEADERS: &'static [&'static HeaderName]
Specifies list of headers you want to inspect via http.headers attribute
Provided Methods§
Sourcefn extract_client_ip(&self, span: &Span, parts: &Parts) -> Option<IpAddr>
fn extract_client_ip(&self, span: &Span, parts: &Parts) -> Option<IpAddr>
Defines way to extract IpAddr from parts
Defaults to always return None
Sourcefn on_request<T>(&self, span: &Span, request: &Request<T>)
fn on_request<T>(&self, span: &Span, request: &Request<T>)
Callback to be called on incoming request
Defaults to be noop
Sourcefn on_response_ok<T>(&self, span: &Span, response: &mut Response<T>)
fn on_response_ok<T>(&self, span: &Span, response: &mut Response<T>)
Callback to be called when successful response is returned
Defaults to be noop
Sourcefn on_response_error(&self, span: &Span, error: &impl Error)
fn on_response_error(&self, span: &Span, error: &impl Error)
Callback to be called when error is returned instead of response
Defaults to be noop
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.