pub struct Path<T>(pub T);Expand description
The route parameters, deserialised with string coercion.
A struct reads them by name; a bare scalar reads the only parameter, so
Path<u64> works for /posts/{post} without a wrapper struct.
let request = Arc::new(Request::builder().route_param("post", "42").build());
let Path(id) = Path::<u64>::from_request(request).await.unwrap();
assert_eq!(id, 42);Tuple Fields§
§0: TTrait Implementations§
impl<T: Copy> Copy for Path<T>
Source§impl<T: DeserializeOwned + Send + 'static> FromRequest for Path<T>
impl<T: DeserializeOwned + Send + 'static> FromRequest for Path<T>
Source§fn from_request(request: Arc<Request>) -> BoxedFuture<Result<Self>>
fn from_request(request: Arc<Request>) -> BoxedFuture<Result<Self>>
Build
Self from the request, or fail with the error the client should
see (a 400 for a malformed body, a 422 for a failed contract).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> UnsafeUnpin for Path<T>where
T: UnsafeUnpin,
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