summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorSam Scott <sam.scott89@gmail.com>2019-01-23 12:06:41 -0500
committerSam Scott <sam.scott89@gmail.com>2019-01-23 12:06:41 -0500
commit30c3802305fab702c1704091013c5af874997c01 (patch)
tree41bd13460f5752caed77ec459efe9264b1629e24 /src/lib.rs
parent3fe8fc3dc024cf46c25223ce3f8fb7bcbfb15547 (diff)
Add feature for easy use in `actix_web` extractors.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs15
1 files changed, 15 insertions, 0 deletions
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<Info>) -> Result<String> {
+//! 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;