diff --git a/Cargo.toml b/Cargo.toml index 2cc7ce97..ab383969 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;