pub struct TraceId<T>where
T: MakeTraceId,{
pub id: T,
}Expand description
Access the current request’s trace id.
use axum::{routing::get, Router};
use axum_trace_id::{SetTraceIdLayer, TraceId};
let app: Router = Router::new()
.route(
"/",
get(|trace_id: TraceId<String>| async move { trace_id.to_string() }),
)
.layer(SetTraceIdLayer::<String>::new());Fields§
§id: TTrait Implementations§
Source§impl<T> Display for TraceId<T>where
T: MakeTraceId,
impl<T> Display for TraceId<T>where
T: MakeTraceId,
Auto Trait Implementations§
impl<T> Freeze for TraceId<T>where
T: Freeze,
impl<T> RefUnwindSafe for TraceId<T>where
T: RefUnwindSafe,
impl<T> Send for TraceId<T>
impl<T> Sync for TraceId<T>
impl<T> Unpin for TraceId<T>where
T: Unpin,
impl<T> UnwindSafe for TraceId<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, B, T> FromRequest<S, B, ViaParts> for T
impl<S, B, T> FromRequest<S, B, ViaParts> for T
Source§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.