Struct ajars_surf::surf::http::trace::ServerTiming
[−]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
impl ServerTiming
impl ServerTiming
pub fn new() -> ServerTiming
pub fn new() -> ServerTiming
Create a new instance of ServerTiming
.
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<ServerTiming>, Error>
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<ServerTiming>, Error>
Create a new instance from headers.
pub fn name(&self) -> HeaderName
pub fn name(&self) -> HeaderName
Get the HeaderName
.
pub fn value(&self) -> HeaderValue
pub fn value(&self) -> HeaderValue
Get the HeaderValue
.
Trait Implementations
impl Debug for ServerTiming
impl Debug for ServerTiming
impl<'a> IntoIterator for &'a ServerTiming
impl<'a> IntoIterator for &'a ServerTiming
fn into_iter(self) -> <&'a ServerTiming as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a ServerTiming as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl<'a> IntoIterator for &'a mut ServerTiming
impl<'a> IntoIterator for &'a mut ServerTiming
fn into_iter(self) -> <&'a mut ServerTiming as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a mut ServerTiming as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl IntoIterator for ServerTiming
impl IntoIterator for ServerTiming
fn into_iter(self) -> <ServerTiming as IntoIterator>::IntoIter
fn into_iter(self) -> <ServerTiming as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl ToHeaderValues for ServerTiming
impl ToHeaderValues for ServerTiming
type Iter = IntoIter<HeaderValue>
type Iter = IntoIter<HeaderValue>
Returned iterator over header values which this type may correspond to.
fn to_header_values(
&self
) -> Result<<ServerTiming as ToHeaderValues>::Iter, Error>
fn to_header_values(
&self
) -> Result<<ServerTiming as ToHeaderValues>::Iter, Error>
Converts this object to an iterator of resolved HeaderValues
.
Auto Trait Implementations
impl RefUnwindSafe for ServerTiming
impl Send for ServerTiming
impl Sync for ServerTiming
impl Unpin for ServerTiming
impl UnwindSafe for ServerTiming
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more