提交 2023a014 authored 作者: Serhij S's avatar Serhij S

modbus moved to feature

上级 a3d04e38
...@@ -26,7 +26,7 @@ object-id = "0.1.3" ...@@ -26,7 +26,7 @@ object-id = "0.1.3"
oneshot = { version = "0.1.6", default-features = false, features = ["std"] } oneshot = { version = "0.1.6", default-features = false, features = ["std"] }
parking_lot = "0.12.1" parking_lot = "0.12.1"
pin-project = "1.1.5" pin-project = "1.1.5"
rmodbus = { version = "0.9.3" } rmodbus = { version = "0.9.3", optional = true }
roboplc-derive = { version = "0.1.5" } roboplc-derive = { version = "0.1.5" }
serde = { version = "1.0.197", features = ["derive", "rc"] } serde = { version = "1.0.197", features = ["derive", "rc"] }
serial = "0.4.0" serial = "0.4.0"
...@@ -41,8 +41,9 @@ tokio = { version = "1.36.0", optional = true } ...@@ -41,8 +41,9 @@ tokio = { version = "1.36.0", optional = true }
[features] [features]
eapi = ["eva-common", "eva-sdk", "busrt", "tokio"] eapi = ["eva-common", "eva-sdk", "busrt", "tokio"]
modbus = ["rmodbus"]
openssl-vendored = ["busrt/openssl-vendored", "eva-common/openssl-vendored"] openssl-vendored = ["busrt/openssl-vendored", "eva-common/openssl-vendored"]
full = ["eapi"] full = ["eapi", "modbus"]
[dev-dependencies] [dev-dependencies]
env_logger = "0.11.3" env_logger = "0.11.3"
...@@ -54,6 +55,7 @@ tracing = { version = "0.1.40", features = ["log"] } ...@@ -54,6 +55,7 @@ tracing = { version = "0.1.40", features = ["log"] }
[[example]] [[example]]
name = "plc-modbus" name = "plc-modbus"
path = "examples/plc-modbus.rs" path = "examples/plc-modbus.rs"
required-features = ["modbus"]
[[example]] [[example]]
name = "raw-udp" name = "raw-udp"
......
...@@ -5,6 +5,7 @@ use crate::Result; ...@@ -5,6 +5,7 @@ use crate::Result;
#[cfg(feature = "eapi")] #[cfg(feature = "eapi")]
pub mod eapi; pub mod eapi;
#[cfg(feature = "modbus")]
pub mod modbus; pub mod modbus;
mod raw_udp; mod raw_udp;
......
...@@ -105,6 +105,7 @@ macro_rules! impl_error { ...@@ -105,6 +105,7 @@ macro_rules! impl_error {
} }
impl_error!(std::io::Error, IO); impl_error!(std::io::Error, IO);
#[cfg(feature = "modbus")]
impl_error!(rmodbus::ErrorKind, IO); impl_error!(rmodbus::ErrorKind, IO);
impl_error!(oneshot::RecvError, IO); impl_error!(oneshot::RecvError, IO);
impl_error!(num::ParseIntError, InvalidData); impl_error!(num::ParseIntError, InvalidData);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论