pub struct RequestId(pub String);Expand description
Request ID for tracing and debugging
Tuple Fields§
§0: StringImplementations§
Source§impl RequestId
impl RequestId
Sourcepub fn from_headers_or_random(headers: &HeaderMap) -> Self
pub fn from_headers_or_random(headers: &HeaderMap) -> Self
Read X-Request-ID from headers (validated), or generate an 8-char
random id when the header is absent or rejected.
Sourcepub fn short(&self) -> &str
pub fn short(&self) -> &str
Short 4-char form for log prefixes. Stable for a given full id. Not cryptographically distinct — purely a visual aid.
Sourcepub fn install<B>(req: &mut Request<B>) -> Span
pub fn install<B>(req: &mut Request<B>) -> Span
Ensure a RequestId extension is present on req and return the
request span carrying its short form. Single source of truth for the
span name and field name shared between the HTTPS transport closure
(webserver.rs) and the request-id middleware.
The span is created at Level::ERROR so it remains active even when
the global filter is set to warn or error — the level on the span
gates only span creation, not event filtering inside it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RequestId
impl RefUnwindSafe for RequestId
impl Send for RequestId
impl Sync for RequestId
impl Unpin for RequestId
impl UnsafeUnpin for RequestId
impl UnwindSafe for RequestId
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more