pub struct Typed<T>(pub T);Expand description
Typed path extractor
Extracts path parameters and deserializes them into a struct implementing Deserialize.
This is similar to Path<T>, but supports complex structs that can be deserialized
from a map of parameter names to values (e.g. via serde_json).
§Example
ⓘ
#[derive(Deserialize)]
struct UserParams {
id: u64,
category: String,
}
async fn get_user(Typed(params): Typed<UserParams>) -> impl IntoResponse {
// params.id, params.category
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T> FromRequestParts for Typed<T>where
T: DeserializeOwned + Send,
impl<T> FromRequestParts for Typed<T>where
T: DeserializeOwned + Send,
Source§impl<T> OperationModifier for Typed<T>
impl<T> OperationModifier for Typed<T>
Source§fn update_operation(_op: &mut Operation)
fn update_operation(_op: &mut Operation)
Update the operation
Auto Trait Implementations§
impl<T> Freeze for Typed<T>where
T: Freeze,
impl<T> RefUnwindSafe for Typed<T>where
T: RefUnwindSafe,
impl<T> Send for Typed<T>where
T: Send,
impl<T> Sync for Typed<T>where
T: Sync,
impl<T> Unpin for Typed<T>where
T: Unpin,
impl<T> UnwindSafe for Typed<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