pub struct TimingMiddleware;Expand description
Records a request counter via the after hook.
The counter increments after the final handler has executed and is
injected as the x-request-count response header.
Implementations§
Source§impl TimingMiddleware
impl TimingMiddleware
pub fn new() -> TimingMiddleware
Trait Implementations§
Source§impl Default for TimingMiddleware
impl Default for TimingMiddleware
Source§fn default() -> TimingMiddleware
fn default() -> TimingMiddleware
Returns the “default value” for a type. Read more
Source§impl IMiddleware for TimingMiddleware
impl IMiddleware for TimingMiddleware
Source§fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<ControlFlow<()>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TimingMiddleware: 'async_trait,
fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<ControlFlow<()>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TimingMiddleware: 'async_trait,
Process an HTTP request (before hook). Read more
Source§fn after<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TimingMiddleware: 'async_trait,
fn after<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TimingMiddleware: 'async_trait,
Called after the final handler has executed. Read more
Auto Trait Implementations§
impl Freeze for TimingMiddleware
impl RefUnwindSafe for TimingMiddleware
impl Send for TimingMiddleware
impl Sync for TimingMiddleware
impl Unpin for TimingMiddleware
impl UnsafeUnpin for TimingMiddleware
impl UnwindSafe for TimingMiddleware
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