Expand description
WASM and Native C/C++ bindings for the Modbus workspace.
Provides both WASM browser bindings and native C FFI bindings for the modbus-rs stack.
Browser-facing APIs (feature wasm, wasm32 target only):
WasmModbusClientfor WebSocket/TCP gateway usageWasmSerialModbusClientfor Web Serial (RTU/ASCII)request_serial_portandWasmSerialPortHandlehelpersWasmServerBindingPlanandWasmServerTransportKind(server binding design surface)
Native C FFI — client (feature c, non-wasm targets):
mbus_tcp_client_new/mbus_serial_client_new— create clients, return an IDmbus_tcp_poll/mbus_serial_poll— drive the request/response state machine- Per-operation request functions (coils, registers, discrete inputs, etc.)
- Response data delivered via C function-pointer callbacks in
MbusCallbacks
Native C FFI — server (feature c-server, non-wasm targets):
There are two server integration approaches:
Approach 1 — hand-written handlers (c_server_demo):
Wire FC callbacks directly in main.c via mbus_tcp_server_new.
No code generation required.
Approach 2 — YAML-driven codegen (c_server_demo_yaml):
Declare the device register/coil map in a YAML file. build.rs reads
MBUS_SERVER_APP_CONFIG at compile time and generates a type-safe Rust
dispatcher into $OUT_DIR (never tracked in git). gen-server-app produces
the matching C header (mbus_server_app.h).
MBUS_SERVER_APP_CONFIG=/path/to/server_app.yaml cargo build -p mbus-ffi --features c-server