Comments (3)
This is my Cargo.toml
[package]
name = "test_modbus"
version = "0.1.0"
authors = ["root"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp", "server"] }
[features]
tcp = ["tokio-modbus/tcp"]
server = ["tokio-modbus/server"]
from tokio-modbus.
This is the error
root@zynq:~/test_modbus# cargo build --features "tcp server"
Compiling test_modbus v0.1.0 (/root/test_modbus)
error[E0432]: unresolved import `futures`
--> src/main.rs:4:9
|
4 | use futures::future;
| ^^^^^^^ use of undeclared type or module `futures`
error[E0433]: failed to resolve: use of undeclared type or module `tokio`
--> src/main.rs:2:3
|
2 | #[tokio::main]
| ^^^^^ use of undeclared type or module `tokio`
error[E0433]: failed to resolve: could not find `tcp` in `server`
--> src/main.rs:34:17
|
34 | server::tcp::Server::new(socket_addr).serve(|| Ok(MbServer));
| ^^^ could not find `tcp` in `server`
error[E0277]: `main` has invalid return type `impl std::future::Future`
--> src/main.rs:3:24
|
3 | pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` can only return types that implement `std::process::Termination`
|
= help: consider using `()`, or a `Result`
error[E0752]: `main` function is not allowed to be `async`
--> src/main.rs:3:1
|
3 | pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `main` function is not allowed to be `async`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0277, E0432, E0433, E0752.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `test_modbus`.
To learn more, run the command again with --verbose.
from tokio-modbus.
finally I solve the problem ,below
[dependencies]
tokio-modbus = "*"
tokio = { version = "*", features = ["full"]}
futures = "*"
[features]
tcp = ["tokio-modbus/tcp"]
server = ["tokio-modbus/tcp-server-unstable"]
from tokio-modbus.
Related Issues (20)
- Flow control when using RS-485 HOT 2
- No timeout in the RTU client async implementation HOT 2
- Infinite retry loop with heavy CPU load HOT 5
- "Device or resource busy" in RTU server example HOT 3
- Generalize impl around `Service` usage HOT 5
- Tokio module 'runtime' is private HOT 12
- Asyncronous responses / Multiplexing HOT 2
- How to convert tokio_modbus::Request to bytes? HOT 5
- TCP server example - shared data hashmap HOT 5
- TCP Sync Client HOT 6
- write_multiple_registers taking array as a param HOT 3
- Can not disconnect slave, need help HOT 3
- Although disconnect the context, the SerialStream reopen error HOT 1
- Patterns/best practice for reconnect-after-failure? HOT 1
- How to turn 'tokio_serial::SerialStream' into global static to save it for reuse
- is_connected()? HOT 1
- Modbus RTU - Serial Direction Pin HOT 6
- Dev Dependencies: Upgrade rustls-pemfile and tokio-rustls HOT 4
- Return Modbus exception codes for client and server.
- Use `async-trait` in `Service` trait ? HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tokio-modbus.