summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Scott <sam@osohq.com>2020-12-06 21:54:44 -0500
committerSam Scott <sam@osohq.com>2020-12-06 21:54:44 -0500
commit7dc1b7c86749cbbe50a308e73469659232d9a3bb (patch)
treef5c4f440b0acae16012ff5372f39b5ff5aac8092
parent5ec5d0989476dbae1e1fdb82ba52a39f54d8f7e7 (diff)
Add support for actix 3.
-rw-r--r--Cargo.toml5
-rw-r--r--src/actix.rs19
-rw-r--r--src/lib.rs4
3 files changed, 21 insertions, 7 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 7307e69..e9803e7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,8 @@ version = "0.7.2"
repository = "samscott89/serde_qs"
[dependencies]
-actix-web = { version = "2.0.0", optional = true }
+actix-web = { version = "3.3", optional = true }
+actix-web2 = { package = "actix-web", version = "2.0.0", optional = true }
data-encoding = "2.3.1"
futures = { version = "0.3.8", optional = true }
percent-encoding = "2.1.0"
@@ -33,7 +34,7 @@ serde_urlencoded = "0.7.0"
[features]
default = []
actix = ["actix-web", "futures"]
+actix2 = ["actix-web2", "futures"]
[package.metadata.docs.rs]
features = [ "actix" ]
-all-features = true
diff --git a/src/actix.rs b/src/actix.rs
index 3c0b0ca..d29d6c9 100644
--- a/src/actix.rs
+++ b/src/actix.rs
@@ -5,6 +5,11 @@
use crate::de::Config as QsConfig;
use crate::error::Error as QsError;
+#[cfg(feature = "actix")]
+use actix_web;
+#[cfg(feature = "actix2")]
+use actix_web2 as actix_web;
+
use actix_web::dev::Payload;
use actix_web::{Error as ActixError, FromRequest, HttpRequest, HttpResponse, ResponseError};
use futures::future::{ready, Ready};
@@ -26,8 +31,11 @@ impl ResponseError for QsError {
/// ## Example
///
/// ```rust
-/// #[macro_use] extern crate serde_derive;
-/// extern crate actix_web;
+/// # #[macro_use] extern crate serde_derive;
+/// # #[cfg(feature = "actix")]
+/// # use actix_web;
+/// # #[cfg(feature = "actix2")]
+/// # use actix_web2 as actix_web;
/// use actix_web::{web, App, HttpResponse};
/// use serde_qs::actix::QsQuery;
///
@@ -121,8 +129,11 @@ where
/// Query extractor configuration
///
/// ```rust
-/// #[macro_use] extern crate serde_derive;
-/// extern crate actix_web;
+/// # #[macro_use] extern crate serde_derive;
+/// # #[cfg(feature = "actix")]
+/// # use actix_web;
+/// # #[cfg(feature = "actix2")]
+/// # use actix_web2 as actix_web;
/// use actix_web::{error, web, App, FromRequest, HttpResponse};
/// use serde_qs::actix::QsQuery;
/// use serde_qs::Config as QsConfig;
diff --git a/src/lib.rs b/src/lib.rs
index 7bf11ba..bad68e9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -157,6 +157,8 @@
//! Ok(format!("Welcome {}!", info.username))
//! }
//! ```
+//!
+//! Support for `actix-web 2.0.0` is available via the `actix2` feature.
#![allow()]
#![deny(
@@ -205,7 +207,7 @@
#[macro_use]
extern crate serde;
-#[cfg(feature = "actix")]
+#[cfg(any(feature = "actix", feature = "actix2"))]
pub mod actix;
mod de;
mod error;