pub struct PathParams<T>(pub T);Available on crate feature
server only.Expand description
Extractor for params from request uri
§Examples
use volo_http::server::{
param::PathParams,
route::{Router, get},
};
async fn params(PathParams((uid, tid)): PathParams<(usize, usize)>) -> String {
format!("uid: {uid}, tid: {tid}")
}
let router: Router = Router::new().route("/user/{uid}/posts/{tid}", get(params));Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone> Clone for PathParams<T>
impl<T: Clone> Clone for PathParams<T>
Source§fn clone(&self) -> PathParams<T>
fn clone(&self) -> PathParams<T>
Returns a duplicate 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<T: Debug> Debug for PathParams<T>
impl<T: Debug> Debug for PathParams<T>
Source§impl<T: Default> Default for PathParams<T>
impl<T: Default> Default for PathParams<T>
Source§fn default() -> PathParams<T>
fn default() -> PathParams<T>
Returns the “default value” for a type. Read more
Source§impl<T1> FromContext for PathParams<(T1,)>where
T1: FromPathParam,
impl<T1> FromContext for PathParams<(T1,)>where
T1: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2> FromContext for PathParams<(T1, T2)>where
T1: FromPathParam,
T2: FromPathParam,
impl<T1, T2> FromContext for PathParams<(T1, T2)>where
T1: FromPathParam,
T2: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3> FromContext for PathParams<(T1, T2, T3)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
impl<T1, T2, T3> FromContext for PathParams<(T1, T2, T3)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4> FromContext for PathParams<(T1, T2, T3, T4)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
impl<T1, T2, T3, T4> FromContext for PathParams<(T1, T2, T3, T4)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5> FromContext for PathParams<(T1, T2, T3, T4, T5)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
impl<T1, T2, T3, T4, T5> FromContext for PathParams<(T1, T2, T3, T4, T5)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6> FromContext for PathParams<(T1, T2, T3, T4, T5, T6)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
impl<T1, T2, T3, T4, T5, T6> FromContext for PathParams<(T1, T2, T3, T4, T5, T6)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
T14: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
T14: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
T14: FromPathParam,
T15: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
T14: FromPathParam,
T15: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
T14: FromPathParam,
T15: FromPathParam,
T16: FromPathParam,
impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> FromContext for PathParams<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)>where
T1: FromPathParam,
T2: FromPathParam,
T3: FromPathParam,
T4: FromPathParam,
T5: FromPathParam,
T6: FromPathParam,
T7: FromPathParam,
T8: FromPathParam,
T9: FromPathParam,
T10: FromPathParam,
T11: FromPathParam,
T12: FromPathParam,
T13: FromPathParam,
T14: FromPathParam,
T15: FromPathParam,
T16: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Source§impl<T> FromContext for PathParams<T>where
T: FromPathParam,
impl<T> FromContext for PathParams<T>where
T: FromPathParam,
Source§type Rejection = PathParamsRejection
type Rejection = PathParamsRejection
If the extractor fails, it will return this
Rejection type. Read moreSource§async fn from_context(
cx: &mut ServerContext,
_: &mut Parts,
) -> Result<Self, Self::Rejection>
async fn from_context( cx: &mut ServerContext, _: &mut Parts, ) -> Result<Self, Self::Rejection>
Extract the type from context.
Auto Trait Implementations§
impl<T> Freeze for PathParams<T>where
T: Freeze,
impl<T> RefUnwindSafe for PathParams<T>where
T: RefUnwindSafe,
impl<T> Send for PathParams<T>where
T: Send,
impl<T> Sync for PathParams<T>where
T: Sync,
impl<T> Unpin for PathParams<T>where
T: Unpin,
impl<T> UnwindSafe for PathParams<T>where
T: UnwindSafe,
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