Skip to content

Commit

Permalink
Add internal sync feature
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Jan 31, 2023
1 parent 64caad9 commit 3c31d81
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 3c31d81

Please sign in to comment.