pub fn query<T>(
config: QsConfig
) -> impl Filter<Extract = (T,), Error = Rejection> + Clone where
T: DeserializeOwned + Send + 'static,
Expand description
Extract typed information from from the request’s query.
Example
use warp::Filter;
use serde_qs::Config;
#[derive(Deserialize)]
pub struct UsersFilter {
id: Vec<u64>,
}
fn main() {
let filter = serde_qs::warp::query(Config::default())
.and_then(|info: UsersFilter| async move {
Ok::<_, warp::Rejection>(
info.id.iter().map(|i| i.to_string()).collect::<Vec<String>>().join(", ")
)
})
.recover(serde_qs::warp::recover_fn);
}