Struct salvo_extra::request_id::RequestId
source · #[non_exhaustive]pub struct RequestId {
pub header_name: HeaderName,
pub overwrite: bool,
pub generator: Box<dyn IdGenerator + Send + Sync>,
}
Available on crate feature
request-id
only.Expand description
A middleware for generate request id.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.header_name: HeaderName
The header name for request id.
overwrite: bool
Whether overwrite exists request id. Default is true
generator: Box<dyn IdGenerator + Send + Sync>
The generator for request id.
Implementations§
source§impl RequestId
impl RequestId
sourcepub fn header_name(self, name: HeaderName) -> Self
pub fn header_name(self, name: HeaderName) -> Self
Set the header name for request id.
sourcepub fn overwrite(self, overwrite: bool) -> Self
pub fn overwrite(self, overwrite: bool) -> Self
Set whether overwrite exists request id. Default is true
.
sourcepub fn generator(
self,
generator: impl IdGenerator + Send + Sync + 'static
) -> Self
pub fn generator( self, generator: impl IdGenerator + Send + Sync + 'static ) -> Self
Set the generator for request id.
Trait Implementations§
source§impl Handler for RequestId
impl Handler for RequestId
source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
_res: &'life3 mut Response,
_ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
_res: &'life3 mut Response,
_ctrl: &'life4 mut FlowCtrl
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Auto Trait Implementations§
impl !Freeze for RequestId
impl !RefUnwindSafe for RequestId
impl Send for RequestId
impl Sync for RequestId
impl Unpin for RequestId
impl !UnwindSafe for RequestId
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