From d7242659fe3f31480f501e605f4c804b3515ebc8 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 29 Dec 2017 01:20:29 -0800 Subject: [PATCH] add web feature --- Cargo.toml | 8 +++++++- src/lib.rs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f47f47606..a42a93dae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,12 @@ exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"] name = "actix_redis" path = "src/lib.rs" +[features] +default = ["web"] + +# actix-web integration +web = ["actix-web"] + [dependencies] rand = "0.3" http = "0.1" @@ -30,7 +36,7 @@ actix = "^0.3.5" redis-async = "0.0" cookie = { version="0.10", features=["percent-encode", "secure"] } -actix-web = { git = "https://github.com/actix/actix-web.git" } +actix-web = { git="https://github.com/actix/actix-web.git", optional=true } [dev-dependencies] env_logger = "0.4" diff --git a/src/lib.rs b/src/lib.rs index 38665b500..763936b53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ extern crate actix; -extern crate actix_web; extern crate bytes; extern crate cookie; extern crate futures; @@ -14,8 +13,15 @@ extern crate redis_async; #[macro_use] extern crate failure; +#[cfg(feature="web")] +extern crate actix_web; + mod redis; + +#[cfg(feature="web")] mod session; pub use redis::RedisActor; + +#[cfg(feature="web")] pub use session::RedisSessionBackend;