From 3c31d8179bfa489854906168f40c8c5968df248d Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Tue, 31 Jan 2023 14:12:27 +0100 Subject: [PATCH] Add internal `sync` feature --- Cargo.toml | 7 +++++-- src/client/mod.rs | 2 +- src/prelude.rs | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2cc7ce97..7c2dce89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,8 +45,11 @@ tokio-serial = { version = "5.4.4", default-features = false } default = ["rtu", "tcp"] rtu = ["futures-util/sink"] tcp = ["tokio/net", "futures-util/sink"] -rtu-sync = ["rtu", "dep:tokio-serial"] -tcp-sync = ["tcp"] +# The internal feature `sync` has no effect when used alone. +# It is always enabled together with `rtu-sync` or `tcp-sync`. +sync = [] +rtu-sync = ["rtu", "sync", "dep:tokio-serial"] +tcp-sync = ["tcp", "sync"] server = ["dep:futures"] rtu-server = ["rtu", "server", "tokio/macros", "dep:tokio-serial"] tcp-server-unstable = [ diff --git a/src/client/mod.rs b/src/client/mod.rs index 850fd328..e487d313 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -18,7 +18,7 @@ pub mod rtu; #[cfg(feature = "tcp")] pub mod tcp; -#[cfg(any(feature = "rtu-sync", feature = "tcp-sync"))] +#[cfg(feature = "sync")] pub mod sync; /// Transport independent asynchronous client trait diff --git a/src/prelude.rs b/src/prelude.rs index 9a979602..a4655ae7 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -43,13 +43,13 @@ pub use crate::slave::{Slave, SlaveId}; /////////////////////////////////////////////////////////////////// pub use crate::client::{Client, Reader, Writer}; -#[cfg(any(feature = "rtu-sync", feature = "tcp-sync"))] +#[cfg(feature = "sync")] pub use crate::client::sync::Client as SyncClient; -#[cfg(any(feature = "rtu-sync", feature = "tcp-sync"))] +#[cfg(feature = "sync")] pub use crate::client::sync::Reader as SyncReader; -#[cfg(any(feature = "rtu-sync", feature = "tcp-sync"))] +#[cfg(feature = "sync")] pub use crate::client::sync::Writer as SyncWriter; pub use crate::slave::SlaveContext;