From 30c3802305fab702c1704091013c5af874997c01 Mon Sep 17 00:00:00 2001 From: Sam Scott Date: Wed, 23 Jan 2019 12:06:41 -0500 Subject: Add feature for easy use in `actix_web` extractors. --- src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 53bfef2..b08c49c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -146,6 +146,17 @@ //! assert_eq!(rec_query.unwrap(), query); //! } //! ``` +//! +//! ## Use with `actix_web` extractors +//! +//! The `actix` feature enables the use of `serde_qs::actix::QsQuery`, which +//! is a direct substitute for the `actix_web::Query` and can be used as an extractor: +//! +//! ```ignore +//! fn index(info: QsQuery) -> Result { +//! Ok(format!("Welcome {}!", info.username)) +//! } +//! ``` #![allow()] #![deny( @@ -192,6 +203,8 @@ while_true )] +#[cfg(feature = "actix")] +extern crate actix_web; extern crate data_encoding; #[macro_use] extern crate error_chain; @@ -199,6 +212,8 @@ extern crate percent_encoding; #[macro_use] extern crate serde; +#[cfg(feature = "actix")] +pub mod actix; mod de; mod error; mod ser; -- cgit v1.2.3