pub struct TimingInterceptor { /* private fields */ }Expand description
Interceptor that adds response timing headers.
Adds the X-Response-Time header with the time taken to process the request.
Optionally adds Server-Timing header for browser DevTools integration.
§Example
ⓘ
let interceptor = TimingInterceptor::new();
// Or with Server-Timing header
let interceptor = TimingInterceptor::with_server_timing("app");Implementations§
Source§impl TimingInterceptor
impl TimingInterceptor
Sourcepub fn with_server_timing(self, metric_name: impl Into<String>) -> Self
pub fn with_server_timing(self, metric_name: impl Into<String>) -> Self
Enable Server-Timing header with the given metric name.
Sourcepub fn header_name(self, name: impl Into<String>) -> Self
pub fn header_name(self, name: impl Into<String>) -> Self
Set a custom header name instead of X-Response-Time.
Trait Implementations§
Source§impl Clone for TimingInterceptor
impl Clone for TimingInterceptor
Source§fn clone(&self) -> TimingInterceptor
fn clone(&self) -> TimingInterceptor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimingInterceptor
impl Debug for TimingInterceptor
Source§impl Default for TimingInterceptor
impl Default for TimingInterceptor
Auto Trait Implementations§
impl Freeze for TimingInterceptor
impl RefUnwindSafe for TimingInterceptor
impl Send for TimingInterceptor
impl Sync for TimingInterceptor
impl Unpin for TimingInterceptor
impl UnwindSafe for TimingInterceptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).