Registry / networking / tokio-modbus

tokio-modbus

JSON →
library0.16.5rscratesunverified

Tokio-based Modbus library for asynchronous Modbus communication.

# Cargo.toml [dependencies] tokio-modbus = "0.16.5"
INSTALL
IMPORT
SIG · TOKIO-MODBUS
T
tokio-modbus
networkingrustv0.16.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Context
use tokio_modbus::client::Context;

Connects to a Modbus TCP server and reads a holding register.

use tokio_modbus::prelude::*; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let mut ctx = tcp::connect("127.0.0.1:502".parse()?).await?; let value = ctx.read_holding_registers(0, 1).await?; println!("Register value: {:?}", value); Ok(()) }
Debug
Known issues
gotchaRequires Tokio runtime; will panic if not run inside a Tokio context.
fix
Wrap your code in #[tokio::main] or manually create a Tokio runtime.
affects: >=0.1.0
Upgrade
Version history
0.16.5latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
40
Resources
tokio-modbus — cargo add tokio-modbus · libregistry