pub struct ServerTimingBuilder { /* private fields */ }Expand description
Builder for constructing Server-Timing headers with multiple metrics.
Collects multiple timing entries and formats them as a single header value.
§Example
ⓘ
let timing = ServerTimingBuilder::new()
.add("total", 150.5)
.add_with_desc("db", 42.0, "Database queries")
.add_with_desc("cache", 5.0, "Cache lookup")
.build();
// Result: "total;dur=150.500, db;dur=42.000;desc=\"Database queries\", cache;dur=5.000;desc=\"Cache lookup\""Implementations§
Source§impl ServerTimingBuilder
impl ServerTimingBuilder
Sourcepub fn add(self, name: impl Into<String>, duration_ms: f64) -> Self
pub fn add(self, name: impl Into<String>, duration_ms: f64) -> Self
Add a timing entry with just a name and duration.
Sourcepub fn add_with_desc(
self,
name: impl Into<String>,
duration_ms: f64,
description: impl Into<String>,
) -> Self
pub fn add_with_desc( self, name: impl Into<String>, duration_ms: f64, description: impl Into<String>, ) -> Self
Add a timing entry with a description.
Sourcepub fn add_entry(self, entry: ServerTimingEntry) -> Self
pub fn add_entry(self, entry: ServerTimingEntry) -> Self
Add a pre-built entry.
Trait Implementations§
Source§impl Clone for ServerTimingBuilder
impl Clone for ServerTimingBuilder
Source§fn clone(&self) -> ServerTimingBuilder
fn clone(&self) -> ServerTimingBuilder
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 ServerTimingBuilder
impl Debug for ServerTimingBuilder
Source§impl Default for ServerTimingBuilder
impl Default for ServerTimingBuilder
Source§fn default() -> ServerTimingBuilder
fn default() -> ServerTimingBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ServerTimingBuilder
impl RefUnwindSafe for ServerTimingBuilder
impl Send for ServerTimingBuilder
impl Sync for ServerTimingBuilder
impl Unpin for ServerTimingBuilder
impl UnwindSafe for ServerTimingBuilder
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).