docs.rs failed to build voltage_modbus-0.6.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
voltage_modbus-0.5.1
Voltage Modbus
High-performance Modbus TCP/RTU library for Rust, designed for industrial automation and IoT applications.
Why voltage_modbus?
| Feature | voltage_modbus | tokio-modbus |
|---|---|---|
| Request pipelining | Yes — N requests in ~1 RTT | No — strictly sequential |
| Read coalescing | Yes — auto-merge adjacent reads | No |
| Zero-alloc hot path | Yes — stack frames, persistent buffers | No — per-request heap alloc |
| TCP_NODELAY | Yes — eliminates Nagle delay | No |
| Broadcast (slave=0) | Yes — no-timeout write | Triggers timeout error |
no_std core |
Yes — PDU/protocol/error | No |
| Auto reconnection | Yes | No |
| Float/multi-register codec | Yes — f32/f64/i32 with byte order | No |
| Async trait | RPITIT (zero-cost) | async-trait (Box alloc) |
Features
- Request pipelining — send multiple requests in a single write, match responses by Transaction ID
- Read coalescing — automatically merge adjacent register reads to minimize network round-trips
- Zero-alloc hot path — stack-allocated frames, persistent read buffers, no per-request heap allocation
- Modbus TCP and RTU — generic client architecture, shared PDU logic
no_stdsupport — core modules (PDU, protocol, error, constants) work without std- Broadcast support — slave_id=0 write operations return immediately without waiting for response
- Zero unsafe code — pure safe Rust
- Async/await — built on Tokio with zero-cost async traits (RPITIT)
Installation
For RTU (serial) support:
= { = "0.5", = ["rtu"] }
For no_std (PDU encoding/decoding only):
= { = "0.5", = false }
Quick Start
TCP Client
use ;
use Duration;
async
RTU Client
use ;
use Duration;
async
Pipelining — N Requests in ~1 RTT
use ;
use Duration;
async
Read Coalescing — Auto-merge Adjacent Reads
use ;
use Duration;
async
Supported Function Codes
| Code | Function | Method |
|---|---|---|
| 0x01 | Read Coils | read_01() / read_coils() |
| 0x02 | Read Discrete Inputs | read_02() / read_discrete_inputs() |
| 0x03 | Read Holding Registers | read_03() / read_holding_registers() |
| 0x04 | Read Input Registers | read_04() / read_input_registers() |
| 0x05 | Write Single Coil | write_05() / write_single_coil() |
| 0x06 | Write Single Register | write_06() / write_single_register() |
| 0x0F | Write Multiple Coils | write_0f() / write_multiple_coils() |
| 0x10 | Write Multiple Registers | write_10() / write_multiple_registers() |
Architecture
┌───────────────────────────────────────────────┐
│ Application Layer │
│ │
│ ┌──────────────────┐ ┌─────────────────┐ │
│ │ ModbusTcpClient │ │ ModbusRtuClient │ │
│ │ + pipeline() │ └────────┬────────┘ │
│ │ + coalesced() │ │ │
│ └────────┬─────────┘ │ │
│ │─────────────────────┘ │
│ ┌────────┴──────────────────┐ │
│ │ GenericModbusClient │ │
│ │ (Shared PDU Logic) │ │
│ └───────────────────────────┘ │
└───────────────────────────────────────────────┘
┌───────────────────────────────────────────────┐
│ Transport Layer │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ TcpTransport │ │ RtuTransport │ │
│ │ TCP_NODELAY │ │ CRC-16 │ │
│ │ zero-alloc I/O │ │ frame gap │ │
│ └─────────────────┘ └─────────────────┘ │
└───────────────────────────────────────────────┘
┌───────────────────────────────────────────────┐
│ Core (no_std compatible) │
│ │
│ ModbusPdu · ModbusFunction · ModbusError │
│ constants · protocol · CRC │
└───────────────────────────────────────────────┘
TCP and RTU share identical PDU (Protocol Data Unit), differing only in transport framing.
Documentation
License
MIT License - see LICENSE for details.