pub struct Path<P: PathSpec>(pub P::Captures);Expand description
Extracts typed path captures from the URL.
The extractor reads parts.uri.path() directly and splits it on demand,
so there’s no per-request Vec<String> allocation. When the router has
a configured prefix, the byte length of that prefix is stored in
extensions as PathPrefixOffset so this extractor can skip past it.
§Example
ⓘ
async fn get_user(Path((id,)): Path<path!("users" / u32)>) -> Json<User> {
// id: u32, extracted from /users/42
}Tuple Fields§
§0: P::CapturesTrait Implementations§
Source§impl<P> FromRequestParts for Path<P>
impl<P> FromRequestParts for Path<P>
Auto Trait Implementations§
impl<P> Freeze for Path<P>
impl<P> RefUnwindSafe for Path<P>
impl<P> Send for Path<P>
impl<P> Sync for Path<P>
impl<P> Unpin for Path<P>
impl<P> UnsafeUnpin for Path<P>
impl<P> UnwindSafe for Path<P>
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