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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, A> DynAccess<T> for A
impl<T, A> DynAccess<T> for A
Source§fn load(&self) -> DynGuard<T>
fn load(&self) -> DynGuard<T>
The equivalent of
Access::load.Source§impl<T> FromRequest for Twhere
T: FromRequestParts,
impl<T> FromRequest for Twhere
T: FromRequestParts,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more