pub struct Path<T>(pub T);Expand description
Path parameter extractor
Extracts path parameters defined in the route pattern.
§Example
For route /users/{id}:
ⓘ
async fn get_user(Path(id): Path<i64>) -> impl IntoResponse {
// id is extracted from path
}For multiple params /users/{user_id}/posts/{post_id}:
ⓘ
async fn get_post(Path((user_id, post_id)): Path<(i64, i64)>) -> impl IntoResponse {
// Both params extracted
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: FromStr> FromRequestParts for Path<T>
impl<T: FromStr> FromRequestParts for Path<T>
Source§fn from_request_parts(req: &Request) -> Result<Self>
fn from_request_parts(req: &Request) -> Result<Self>
Extract from request parts
Source§impl<T> OperationModifier for Path<T>
impl<T> OperationModifier for Path<T>
Source§fn update_operation(_op: &mut Operation)
fn update_operation(_op: &mut Operation)
Update the operation
Auto Trait Implementations§
impl<T> Freeze for Path<T>where
T: Freeze,
impl<T> RefUnwindSafe for Path<T>where
T: RefUnwindSafe,
impl<T> Send for Path<T>where
T: Send,
impl<T> Sync for Path<T>where
T: Sync,
impl<T> Unpin for Path<T>where
T: Unpin,
impl<T> UnwindSafe for Path<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