pub struct Query<Q>(pub Q);
Expand description
Query extractor
Allows to use a structure that implements DeserializeOwned
to extract information easier from the query
use cataclysm::http::{Response, Query};
use serde::{Deserialize};
#[derive(Deserialize)]
struct QueryParams {
name: String,
last_name: Option<String>
}
async fn check_query(query: Query<QueryParams>) -> Response {
log::info!("Http call from {}", query.into_inner().name);
Response::ok()
}
Deserialization error will result always in a bad request response
Tuple Fields
0: Q
Implementations
sourceimpl<Q> Query<Q>
impl<Q> Query<Q>
sourcepub fn into_inner(self) -> Q
pub fn into_inner(self) -> Q
Retrieves the inner instance of the generic type
Trait Implementations
Auto Trait Implementations
impl<Q> RefUnwindSafe for Query<Q> where
Q: RefUnwindSafe,
impl<Q> Send for Query<Q> where
Q: Send,
impl<Q> Sync for Query<Q> where
Q: Sync,
impl<Q> Unpin for Query<Q> where
Q: Unpin,
impl<Q> UnwindSafe for Query<Q> where
Q: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more