From c8c918234e11e52c8ac59ad84d8f1237bce2fd4d Mon Sep 17 00:00:00 2001 From: Lee Smet Date: Fri, 8 Mar 2024 18:09:33 +0100 Subject: [PATCH] Close #153: Feature gate http API Signed-off-by: Lee Smet --- Cargo.toml | 3 ++- src/lib.rs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d0b760a..a8e1017 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,9 @@ license-file = "LICENSE" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = ["message"] +default = ["message", "http-api"] message = [] +http-api = [] [dependencies] tokio = { version = "1.36.0", features = [ diff --git a/src/lib.rs b/src/lib.rs index 7f5bc83..6ee8291 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,6 @@ use std::net::{IpAddr, Ipv6Addr, SocketAddr}; +#[cfg(feature = "http-api")] use api::Http; use bytes::BytesMut; use data::DataPlane; @@ -64,6 +65,7 @@ pub struct Stack { _pm: peer_manager::PeerManager, #[cfg(feature = "message")] _ms: message::MessageStack, + #[cfg(feature = "http-api")] _api: api::Http, } @@ -170,6 +172,7 @@ impl Stack { #[cfg(feature = "message")] let ms = MessageStack::new(_data_plane, msg_receiver); + #[cfg(feature = "http-api")] let api = Http::spawn( router.clone(), pm.clone(), @@ -183,6 +186,7 @@ impl Stack { _pm: pm, #[cfg(feature = "message")] _ms: ms, + #[cfg(feature = "http-api")] _api: api, }) }