pub struct ServerTimings { /* private fields */ }Expand description
Tracker for server timings.
Implements IntoResponseParts, so it can be returned at the start of an axum response tuple.
Implementations§
Source§impl ServerTimings
impl ServerTimings
pub fn new() -> Self
Sourcepub fn add_timing(&mut self, timing: Timing)
pub fn add_timing(&mut self, timing: Timing)
Add a raw timing to the internal timing list. The internal duration tracker is not updated.
Sourcepub fn record(
&mut self,
name: impl Into<Cow<'static, str>>,
desc: impl Into<Cow<'static, str>>,
)
pub fn record( &mut self, name: impl Into<Cow<'static, str>>, desc: impl Into<Cow<'static, str>>, )
Record a timing event, with a name and description. These can be string literals or normal strings. The time since the last event is recorded automatically.
Sourcepub fn record_name(&mut self, name: impl Into<Cow<'static, str>>)
pub fn record_name(&mut self, name: impl Into<Cow<'static, str>>)
Like Self::record, but without a description. Useful for conserving bandwidth.
Trait Implementations§
Source§impl Default for ServerTimings
impl Default for ServerTimings
Source§impl IntoResponseParts for ServerTimings
impl IntoResponseParts for ServerTimings
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of an error. Read more
Source§fn into_response_parts(
self,
res: ResponseParts,
) -> Result<ResponseParts, Self::Error>
fn into_response_parts( self, res: ResponseParts, ) -> Result<ResponseParts, Self::Error>
Set parts of the response
Auto Trait Implementations§
impl Freeze for ServerTimings
impl RefUnwindSafe for ServerTimings
impl Send for ServerTimings
impl Sync for ServerTimings
impl Unpin for ServerTimings
impl UnwindSafe for ServerTimings
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