pub struct Query<V>(pub V);Expand description
The Query extractor
Tuple Fields§
§0: VImplementations§
Source§impl<T> Query<T>
impl<T> Query<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get the inner value
Examples found in repository?
examples/basic.rs (line 103)
96async fn test_handler(
97 query: Option<Query<TestTest>>,
98 json: Json<TestTest>,
99) -> impl Responder<Body = BoxBody> {
100 let json = json.into_inner();
101
102 if let Some(query) = query {
103 let test = query.into_inner();
104
105 assert_eq!(test.username, json.username);
106 assert_eq!(test.password, json.password);
107 }
108
109 format!("Hello, {}!", json.username)
110}Source§impl<T: DeserializeOwned> Query<T>
impl<T: DeserializeOwned> Query<T>
Sourcepub fn from_query(query: &str) -> Result<Self, ExtractionError>
pub fn from_query(query: &str) -> Result<Self, ExtractionError>
Create a new Query extractor from the query
Trait Implementations§
Source§impl<V: DeserializeOwned> FromRequest for Query<V>
impl<V: DeserializeOwned> FromRequest for Query<V>
Source§type Error = ExtractionError
type Error = ExtractionError
The error that can happen when extracting data
Source§type Future = Ready<Result<Query<V>, <Query<V> as FromRequest>::Error>>
type Future = Ready<Result<Query<V>, <Query<V> as FromRequest>::Error>>
The future that will be used to extract the data
Source§fn from_request(req: &HttpRequest, _: &mut HttpPayload) -> Self::Future
fn from_request(req: &HttpRequest, _: &mut HttpPayload) -> Self::Future
Extracts a value of type
Self from the request. The request contains the request body at the moment but that might change in the futureSource§fn extract(req: &HttpRequest) -> Self::Future
fn extract(req: &HttpRequest) -> Self::Future
Extracts a value of type
Self from the requestSource§impl<V: Ord> Ord for Query<V>
impl<V: Ord> Ord for Query<V>
Source§impl<V: PartialOrd> PartialOrd for Query<V>
impl<V: PartialOrd> PartialOrd for Query<V>
impl<V: Eq> Eq for Query<V>
impl<V> StructuralPartialEq for Query<V>
Auto Trait Implementations§
impl<V> Freeze for Query<V>where
V: Freeze,
impl<V> RefUnwindSafe for Query<V>where
V: RefUnwindSafe,
impl<V> Send for Query<V>where
V: Send,
impl<V> Sync for Query<V>where
V: Sync,
impl<V> Unpin for Query<V>where
V: Unpin,
impl<V> UnwindSafe for Query<V>where
V: 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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.