Struct RawPathParams

pub struct RawPathParams(/* private field */);

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 &params {
        println!("{key:?} = {value:?}");
    }
}

let app = Router::new().route("/users/{user_id}/team/{team_id}", get(users_teams_show));
# let _: Router = app;

Implementations

impl RawPathParams

fn iter(&self) -> RawPathParamsIter<'_>

Get an iterator over the path parameters.

Trait Implementations

impl Debug for RawPathParams

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<S> FromRequestParts<S> for RawPathParams where S: Send + Sync,

type Rejection = RawPathParamsRejection;
async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection>

Auto Trait Implementations

impl Freeze for RawPathParams

impl RefUnwindSafe for RawPathParams

impl Send for RawPathParams

impl Sync for RawPathParams

impl Unpin for RawPathParams

impl UnsafeUnpin for RawPathParams

impl UnwindSafe for RawPathParams

Blanket Implementations

impl<S, T> FromRequest<S, ViaParts> for RawPathParams 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 RawPathParams where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for RawPathParams where ST: ?Sized, DT: ?Sized,

impl<T> Any for RawPathParams where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for RawPathParams where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for RawPathParams where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for RawPathParams

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for RawPathParams

impl<T> Read<Exclusive, BecauseExclusive> for RawPathParams where T: ?Sized,

impl<T> Same for RawPathParams

type Output = T;

impl<T> WithSubscriber for RawPathParams

impl<T, U> Into<U> for RawPathParams where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for RawPathParams where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for RawPathParams 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 RawPathParams where V: MultiLane<T>,

fn vzip(self) -> V