Struct axum::extract::RawPathParams
source · 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§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, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, 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.