14 releases

0.5.1 Nov 21, 2021
0.4.1 Aug 13, 2021
0.4.0 Mar 13, 2020
0.3.5 Sep 17, 2019
0.0.0 Aug 21, 2017

#11 in Hardware support

Download history 249/week @ 2021-08-10 368/week @ 2021-08-17 150/week @ 2021-08-24 277/week @ 2021-08-31 308/week @ 2021-09-07 459/week @ 2021-09-14 261/week @ 2021-09-21 164/week @ 2021-09-28 248/week @ 2021-10-05 472/week @ 2021-10-12 460/week @ 2021-10-19 329/week @ 2021-10-26 264/week @ 2021-11-02 385/week @ 2021-11-09 300/week @ 2021-11-16 255/week @ 2021-11-23

1,306 downloads per month
Used in 6 crates (4 directly)

MIT/Apache

135KB
3K SLoC

tokio-modbus

A tokio-based modbus library.

Crates.io Docs.rs Security audit Continuous integration

Features

  • Pure Rust library
  • Modbus TCP or RTU at your choice
  • Both async (non-blocking, default) and sync (blocking, optional)
  • Client API
  • Server implementations
    • for out-of-the-box usage or
    • as a starting point for a customized implementation
  • Open source (MIT/Apache-2.0)

Installation

Add this to your Cargo.toml:

[dependencies]
tokio-modbus = "*"

If you like to use Modbus TCP only:

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp"] }

If you like to use Modbus RTU only:

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["rtu"] }

If you like to build a TCP server:

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp", "server"] }

Examples

Various examples for Modbus RTU and TCP using either the asynchronous or synchronous API can be found in the examples folder.

Testing

The workspace contains documentation, tests, and examples for all available features. Running the tests for the whole workspace only succeeds with all features enabled:

cargo test --workspace --all-features

Otherwise some doctests that require non-default features like sync are expected to fail.

Protocol-Specification

License

Copyright 2017 - 2021 slowtec GmbH

MIT/Apache-2.0

Dependencies

~2.8–4.5MB
~78K SLoC