pub struct ServerTiming { /* private fields */ }
Expand description
Metrics and descriptions for the given request-response cycle.
§Specifications
§Examples
use http_types::Response;
use http_types::trace::{ServerTiming, Metric};
let mut timings = ServerTiming::new();
timings.push(Metric::new("server".to_owned(), None, None)?);
let mut res = Response::new(200);
timings.apply(&mut res);
let timings = ServerTiming::from_headers(res)?.unwrap();
let entry = timings.iter().next().unwrap();
assert_eq!(entry.name(), "server");
Implementations§
Source§impl ServerTiming
impl ServerTiming
Sourcepub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
pub fn from_headers(headers: impl AsRef<Headers>) -> Result<Option<Self>>
Create a new instance from headers.
Sourcepub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
Sourcepub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations§
Source§impl Debug for ServerTiming
impl Debug for ServerTiming
Source§impl<'a> IntoIterator for &'a ServerTiming
impl<'a> IntoIterator for &'a ServerTiming
Source§impl<'a> IntoIterator for &'a mut ServerTiming
impl<'a> IntoIterator for &'a mut ServerTiming
Source§impl IntoIterator for ServerTiming
impl IntoIterator for ServerTiming
Source§impl ToHeaderValues for ServerTiming
impl ToHeaderValues for ServerTiming
Source§type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
Source§fn to_header_values(&self) -> Result<Self::Iter>
fn to_header_values(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved
HeaderValues
.Auto Trait Implementations§
impl Freeze for ServerTiming
impl RefUnwindSafe for ServerTiming
impl Send for ServerTiming
impl Sync for ServerTiming
impl Unpin for ServerTiming
impl UnwindSafe for ServerTiming
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