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§
§impl RawPathParams
impl RawPathParams
pub fn iter(&self) -> RawPathParamsIter<'_> ⓘ
pub fn iter(&self) -> RawPathParamsIter<'_> ⓘ
Get an iterator over the path parameters.
Trait Implementations§
§impl Debug for RawPathParams
impl Debug for RawPathParams
§impl<S> FromRequestParts<S> for RawPathParams
impl<S> FromRequestParts<S> for RawPathParams
§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.
§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.
§impl<'a> IntoIterator for &'a RawPathParams
impl<'a> IntoIterator for &'a RawPathParams
§type IntoIter = RawPathParamsIter<'a>
type IntoIter = RawPathParamsIter<'a>
Which kind of iterator are we turning this into?
§fn into_iter(self) -> <&'a RawPathParams as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a RawPathParams as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
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
§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.