pub struct ValidatedRequestIdLayer { /* private fields */ }Expand description
Tower layer that validates, generates, stores, and propagates request IDs.
Valid inbound request IDs are UUID v4 strings. With
RequestIdMode::Strict, malformed inbound IDs receive 400 Bad Request.
With RequestIdMode::Permissive, malformed inbound IDs are replaced with a
generated ID. Generated IDs are UUID v4 by default.
On accepted requests, the final ID is inserted into the configured request
header, added to request extensions through RequestContext, and copied to
the response header if the inner service did not set one. Use
crate::middleware::request_context_layer after this layer when you want
the context enriched with route and correlation fields before handlers run.
Implementations§
Source§impl ValidatedRequestIdLayer
impl ValidatedRequestIdLayer
Sourcepub fn new(config: RequestIdConfig) -> Self
pub fn new(config: RequestIdConfig) -> Self
Creates a validated request ID layer from typed config.
Trait Implementations§
Source§impl Clone for ValidatedRequestIdLayer
impl Clone for ValidatedRequestIdLayer
Source§fn clone(&self) -> ValidatedRequestIdLayer
fn clone(&self) -> ValidatedRequestIdLayer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidatedRequestIdLayer
impl Debug for ValidatedRequestIdLayer
Auto Trait Implementations§
impl !Freeze for ValidatedRequestIdLayer
impl !RefUnwindSafe for ValidatedRequestIdLayer
impl !UnwindSafe for ValidatedRequestIdLayer
impl Send for ValidatedRequestIdLayer
impl Sync for ValidatedRequestIdLayer
impl Unpin for ValidatedRequestIdLayer
impl UnsafeUnpin for ValidatedRequestIdLayer
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