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,