pub struct QsQuery<T>(/* private fields */);
Expand description
Extract typed information from from the request’s query.
§Example
use actix_web::{web, App, HttpResponse};
use serde_qs::actix::QsQuery;
#[derive(Deserialize)]
pub struct UsersFilter {
id: Vec<u64>,
}
// Use `QsQuery` extractor for query information.
// The correct request for this handler would be `/users?id[]=1124&id[]=88"`
async fn filter_users(info: QsQuery<UsersFilter>) -> HttpResponse {
HttpResponse::Ok().body(
info.id.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(", ")
)
}
fn main() {
let app = App::new().service(
web::resource("/users")
.route(web::get().to(filter_users)));
}
Implementations§
source§impl<T> QsQuery<T>
impl<T> QsQuery<T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwrap into inner T value
Trait Implementations§
source§impl<T> FromRequest for QsQuery<T>where
T: DeserializeOwned,
impl<T> FromRequest for QsQuery<T>where
T: DeserializeOwned,
source§fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future
Create a
Self
from request parts asynchronously.source§impl<T: Ord> Ord for QsQuery<T>
impl<T: Ord> Ord for QsQuery<T>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq> PartialEq for QsQuery<T>
impl<T: PartialEq> PartialEq for QsQuery<T>
source§impl<T: PartialOrd> PartialOrd for QsQuery<T>
impl<T: PartialOrd> PartialOrd for QsQuery<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T: Eq> Eq for QsQuery<T>
impl<T> StructuralPartialEq for QsQuery<T>
Auto Trait Implementations§
impl<T> Freeze for QsQuery<T>where
T: Freeze,
impl<T> RefUnwindSafe for QsQuery<T>where
T: RefUnwindSafe,
impl<T> Send for QsQuery<T>where
T: Send,
impl<T> Sync for QsQuery<T>where
T: Sync,
impl<T> Unpin for QsQuery<T>where
T: Unpin,
impl<T> UnwindSafe for QsQuery<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<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.