pub struct MatchedPath(pub String);Expand description
Routing-time path template attached to the request.
Router::dispatch inserts a MatchedPath into request extensions before
running middleware and the handler so that metrics, logs, and extractors
can label by the route template (e.g. /users/{id}) rather than the
concrete URI (/users/42).
This is also the public extractor type — tako-extractors re-exports it
from this module so the extension key and the user-facing extractor share
one canonical type. Previously the extractor was a separate newtype with
the same name, which made it easy to insert the wrong type into request
extensions and have lookups silently miss.
Tuple Fields§
§0: StringImplementations§
Trait Implementations§
Source§impl Clone for MatchedPath
impl Clone for MatchedPath
Source§fn clone(&self) -> MatchedPath
fn clone(&self) -> MatchedPath
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 MatchedPath
impl Debug for MatchedPath
Source§impl<'a> FromRequest<'a> for MatchedPath
impl<'a> FromRequest<'a> for MatchedPath
Source§type Error = MatchedPathMissing
type Error = MatchedPathMissing
Error type returned when extraction fails.
Source§fn from_request(
req: &'a mut Request<TakoBody>,
) -> impl Future<Output = Result<MatchedPath, <MatchedPath as FromRequest<'a>>::Error>> + Send + 'a
fn from_request( req: &'a mut Request<TakoBody>, ) -> impl Future<Output = Result<MatchedPath, <MatchedPath as FromRequest<'a>>::Error>> + Send + 'a
Extracts the type from the HTTP request.
Source§impl<'a> FromRequestParts<'a> for MatchedPath
impl<'a> FromRequestParts<'a> for MatchedPath
Source§type Error = MatchedPathMissing
type Error = MatchedPathMissing
Error type returned when extraction fails.
Source§fn from_request_parts(
parts: &'a mut Parts,
) -> impl Future<Output = Result<MatchedPath, <MatchedPath as FromRequestParts<'a>>::Error>> + Send + 'a
fn from_request_parts( parts: &'a mut Parts, ) -> impl Future<Output = Result<MatchedPath, <MatchedPath as FromRequestParts<'a>>::Error>> + Send + 'a
Extracts the type from the HTTP request parts.
Auto Trait Implementations§
impl Freeze for MatchedPath
impl RefUnwindSafe for MatchedPath
impl Send for MatchedPath
impl Sync for MatchedPath
impl Unpin for MatchedPath
impl UnsafeUnpin for MatchedPath
impl UnwindSafe for MatchedPath
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<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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