Struct axum::extract::NestedPath
source · pub struct NestedPath(/* private fields */);
Expand description
Access the path the matched the route is nested at.
This can for example be used when doing redirects.
§Example
use axum::{
Router,
extract::NestedPath,
routing::get,
};
let api = Router::new().route(
"/users",
get(|path: NestedPath| async move {
// `path` will be "/api" because thats what this
// router is nested at when we build `app`
let path = path.as_str();
})
);
let app = Router::new().nest("/api", api);
Implementations§
Trait Implementations§
source§impl Clone for NestedPath
impl Clone for NestedPath
source§fn clone(&self) -> NestedPath
fn clone(&self) -> NestedPath
Returns a copy of the value. Read more
1.0.0 · 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 NestedPath
impl Debug for NestedPath
source§impl<S> FromRequestParts<S> for NestedPath
impl<S> FromRequestParts<S> for NestedPath
§type Rejection = NestedPathRejection
type Rejection = NestedPathRejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Auto Trait Implementations§
impl Freeze for NestedPath
impl RefUnwindSafe for NestedPath
impl Send for NestedPath
impl Sync for NestedPath
impl Unpin for NestedPath
impl UnwindSafe for NestedPath
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<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
§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.