Struct MatchedPath
pub struct MatchedPath(/* private field */);
Access the path in the router that matches the request.
use ;
let app = new.route;
# let _: Router = app;
Accessing MatchedPath via extensions
MatchedPath can also be accessed from middleware via request extensions.
This is useful for example with Trace to
create a span that contains the matched path:
use ;
use TraceLayer;
let app = new
.route
.layer;
# let _: Router = app;
Implementations
impl MatchedPath
fn as_str(&self) -> &strReturns a
strrepresentation of the path.
Trait Implementations
impl Clone for MatchedPath
fn clone(&self) -> MatchedPath
impl Debug for MatchedPath
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<S> FromRequestParts<S> for MatchedPath
where
S: Send + Sync,
type Rejection = MatchedPathRejection;async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection>
impl<S> OptionalFromRequestParts<S> for MatchedPath
where
S: Send + Sync,
type Rejection = never;async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Option<Self>, Self::Rejection>
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
impl<S, T> FromRequest<S, ViaParts> for MatchedPath
where
S: Send + Sync,
T: FromRequestParts<S>,
type Rejection = <T as FromRequestParts<S>>::Rejection;fn from_request(req: Request<Body>, state: &S) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for MatchedPath
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for MatchedPath
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for MatchedPath
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for MatchedPath
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for MatchedPath
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for MatchedPath
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for MatchedPath
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FromRef<T> for MatchedPath
where
T: Clone,
fn from_ref(input: &T) -> T
impl<T> Instrument for MatchedPath
impl<T> Read<Exclusive, BecauseExclusive> for MatchedPath
where
T: ?Sized,
impl<T> Same for MatchedPath
type Output = T;
impl<T> ToOwned for MatchedPath
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for MatchedPath
impl<T, U> Into<U> for MatchedPath
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for MatchedPath
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for MatchedPath
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip<V> for MatchedPath
where
V: MultiLane<T>,
fn vzip(self) -> V