Expand description
Rust client for the Motorcortex real-time control system.
Implements the wire protocol defined by motorcortex.proto over
NNG + WebSocket Secure: request/reply for parameter access,
publish/subscribe for real-time streaming, and the session-token
dance that keeps long-lived connections alive through reverse
proxies and transient server restarts.
Two frontends share one actor-style core:
core— async (tokio-driven). The recommended surface. Handles areClone + Send + Sync; multiple tasks share one connection safely.blocking— thin sync wrapper for scripts, tests, and code that doesn’t want a tokio runtime inmain(). Same method names and semantics, just without.await.
§Example — async round-trip
use motorcortex_rust::core::Request;
use motorcortex_rust::{ConnectionOptions, Result};
let opts = ConnectionOptions::new("tests/mcx.cert.crt".into(), 5000, 5000);
let req = Request::connect_to("wss://127.0.0.1:5568", opts).await?;
req.login("root", "secret").await?;
req.request_parameter_tree().await?;
let value: f64 = req.get_parameter("root/Control/dummyDouble").await?;
println!("{value}");
req.disconnect().await?;See the examples/ directory for blocking, subscribe-latest,
and subscribe-stream flavours, and ARCHITECTURE.md for the
design rationale — actor driver, three-sink subscription model,
reconnect + session-token machinery.
Re-exports§
pub use core::ConnectionState;
Modules§
- blocking
- Blocking façade over the async
core::*types. - core
- Async-first core: actor-style
Request/Subscribe+ their drivers. - nng_
init_ parameter
Structs§
- Connection
Options - Options used to configure the connection settings.
- Console
CmdList Msg - Console
CmdMsg - Create
Group Msg - Error
- Error
List - GetParameter
List Msg - GetParameter
Msg - GetParameter
Tree Hash Msg - GetParameter
Tree Msg - GetSession
Token Msg - Group
Msg - Group
Parameter Info - Group
Status Msg - Header
- LoadMsg
- Login
Msg - Logout
Msg - Overwrite
Parameter Msg - Parameter
Info - Parameter
List Msg - Parameter
Msg - Parameter
Offset - Parameter
Tree - Parameter
Tree Hash Msg - Parameter
Tree Msg - Release
Parameter Msg - Remove
Group Msg - Restore
Session Msg - SaveMsg
- Session
Token Msg - SetParameter
List Msg - SetParameter
Msg - Status
Msg - Time
Spec
Enums§
- Data
Type - Error
Level - LogLevel
- Motorcortex
Error - Error type for all motorcortex-rust operations.
- Offset
Type - Parameter
Flag - Parameter
Type - Permission
- Status
Code - Unit
- User
Group
Traits§
- GetParameter
Value - Hash
- Represents a trait for associating a unique, compile-time constant hash with a type.
- Parameters
- SetParameter
Value
Functions§
- get_
hash - Retrieve a compile-time constant hash for a message type.
- get_
hash_ size - Retrieve the size, in bytes, of a compile-time constant hash used in the system.
- init_
debug_ logger - init_
logger - init_
threads - init_
threads_ with_ defaults - parse_
url - Split a Motorcortex URL into
(req_url, sub_url).
Type Aliases§
- Result
- Convenience alias used throughout the library.