From 19370bce14de9a3d59a27103410d242ca75ff7a0 Mon Sep 17 00:00:00 2001 From: Henry Zimmerman Date: Sun, 10 Nov 2019 21:52:56 -0500 Subject: [PATCH] Add a default-enabled feature gate for agents and services (#684) * Add a default-enabled feature gate for agents and services * cargo fmt * change feature name for agent support from agents to agent --- Cargo.toml | 4 +++- src/lib.rs | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b3cf4bc69a5..e88296de3eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,10 +53,12 @@ trybuild = "1.0" rustversion = "0.1" [features] -default = [] +default = ["services", "agent"] doc_test = [] web_test = [] wasm_test = [] +services = [] +agent = [] yaml = ["serde_yaml"] msgpack = ["rmp-serde"] cbor = ["serde_cbor"] diff --git a/src/lib.rs b/src/lib.rs index 36075223621..de60904602d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,17 +75,20 @@ pub mod macros { pub use yew_macro::Properties; } -pub mod agent; pub mod app; pub mod callback; pub mod components; pub mod format; pub mod html; pub mod scheduler; -pub mod services; pub mod utils; pub mod virtual_dom; +#[cfg(feature = "agent")] +pub mod agent; +#[cfg(feature = "services")] +pub mod services; + /// The module that contains all events available in the framework. pub mod events { pub use crate::html::{ChangeData, InputData}; @@ -142,6 +145,7 @@ where /// use yew::prelude::*; /// ``` pub mod prelude { + #[cfg(feature = "agent")] pub use crate::agent::{Bridge, Bridged, Threaded}; pub use crate::app::App; pub use crate::callback::Callback; @@ -154,6 +158,7 @@ pub mod prelude { pub use crate::virtual_dom::Classes; /// Prelude module for creating worker. + #[cfg(feature = "agent")] pub mod worker { pub use crate::agent::{ Agent, AgentLink, Bridge, Bridged, Context, Global, HandlerId, Job, Private, Public,