pub struct RawPathParams(/* private fields */);
Expand description
Extractor that will get captures from the URL without deserializing them.
In general you should prefer to use Path
as it is higher level, however RawPathParams
is
suitable if just want the raw params without deserializing them and thus saving some
allocations.
Any percent encoded parameters will be automatically decoded. The decoded parameters must be
valid UTF-8, otherwise RawPathParams
will fail and return a 400 Bad Request
response.
ยงExample
use axum::{
extract::RawPathParams,
routing::get,
Router,
};
async fn users_teams_show(params: RawPathParams) {
for (key, value) in ¶ms {
println!("{key:?} = {value:?}");
}
}
let app = Router::new().route("/users/:user_id/team/:team_id", get(users_teams_show));
Implementationsยง
Sourceยงimpl RawPathParams
impl RawPathParams
Sourcepub fn iter(&self) -> RawPathParamsIter<'_> โ
pub fn iter(&self) -> RawPathParamsIter<'_> โ
Get an iterator over the path parameters.
Trait Implementationsยง
Sourceยงimpl Debug for RawPathParams
impl Debug for RawPathParams
Sourceยงimpl<S> FromRequestParts<S> for RawPathParams
impl<S> FromRequestParts<S> for RawPathParams
Sourceยงtype Rejection = RawPathParamsRejection
type Rejection = RawPathParamsRejection
If the extractor fails itโll use this โrejectionโ type. A rejection is
a kind of error that can be converted into a response.
Sourceยงfn from_request_parts<'life0, 'life1, 'async_trait>(
parts: &'life0 mut Parts,
_state: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<RawPathParams, <RawPathParams as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RawPathParams: 'async_trait,
fn from_request_parts<'life0, 'life1, 'async_trait>(
parts: &'life0 mut Parts,
_state: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<RawPathParams, <RawPathParams as FromRequestParts<S>>::Rejection>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RawPathParams: 'async_trait,
Perform the extraction.
Sourceยงimpl<'a> IntoIterator for &'a RawPathParams
impl<'a> IntoIterator for &'a RawPathParams
Auto Trait Implementationsยง
impl Freeze for RawPathParams
impl RefUnwindSafe for RawPathParams
impl Send for RawPathParams
impl Sync for RawPathParams
impl Unpin for RawPathParams
impl UnwindSafe for RawPathParams
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, 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.