From 895d54d26d7325f83df963794c815b00f19990d0 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Sun, 6 Jun 2021 09:44:10 +0530 Subject: [PATCH] feature gating actor stuff --- Cargo.toml | 28 ++++++++++++++++++++++------ src/lib.rs | 11 +++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fd04387..0c79a45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,20 +11,36 @@ edition = "2018" readme = "README.md" [dependencies] -actix = "0.10" +actix = { version = "0.10", optional = true} serde = "1.0.114" serde_json = "1" -pretty_env_logger = "0.4" -log = "0.4" +pretty_env_logger = {version = "0.4", optional = true } +log = {version = "0.4", optional = true } derive_builder = "0.9" derive_more = "0.99" -rand = "0.8" -pow_sha256 = { version = "0.2.1", git = "https://github.com/mcaptcha/pow_sha256" } -redis = { version = "0.20.1", features = ["tokio-comp","aio", "cluster"] } +rand = {version = "0.8", optional = true } + + +pow_sha256 = { version = "0.2.1", git = "https://github.com/mcaptcha/pow_sha256", optional=true } +redis = { version = "0.20.1", features = ["tokio-comp","aio", "cluster"], optional=true } [dev-dependencies] actix-rt = "1" + +[features] +default = [ + "minimal", + "full", + "actix", + "rand", + "log", + "pretty_env_logger", + "pow_sha256", + "redis" +] +minimal = [] +full = [] diff --git a/src/lib.rs b/src/lib.rs index 62ac148..07e6dcb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -183,19 +183,30 @@ //! } //! ``` #![forbid(unsafe_code)] +#[cfg(feature = "minimal")] pub mod defense; pub mod errors; +#[cfg(feature = "full")] pub mod master; /// message datatypes to interact with [MCaptcha] actor +#[cfg(feature = "full")] pub mod cache; +#[cfg(feature = "minimal")] pub mod mcaptcha; +#[cfg(feature = "full")] pub mod pow; +#[cfg(feature = "full")] pub mod system; +#[cfg(feature = "full")] mod utils; +#[cfg(feature = "full")] pub use crate::cache::hashcache::HashCache; +#[cfg(feature = "minimal")] pub use defense::{Defense, DefenseBuilder, LevelBuilder}; +#[cfg(feature = "full")] pub use master::embedded::counter::Counter; +#[cfg(feature = "minimal")] pub use mcaptcha::{MCaptcha, MCaptchaBuilder};