Expand description
MQTT vocabulary for eBus.
The messages and commands the Homie state machines exchange with an MQTT
client, topic filter matching, and, with alloc, the FilterLedger that
tracks which subscriptions the client holds and who may remove them, the
Role trait those state machines implement, and Pair, which runs two
of them on one link.
The crate performs no I/O and reads no clock: time arrives as an Instant
the caller supplies, received messages arrive as Messages, and work for
the MQTT client leaves as Commands.
use ebus_mqtt::filter;
assert!(filter::matches("ebus/5/+/$state", "ebus/5/meter-1/$state"));
assert!(filter::matches("ebus/5/meter-1/#", "ebus/5/meter-1/power/watts"));
// A leading wildcard does not match a topic that starts with `$`.
assert!(!filter::matches("+/5/meter-1/$state", "$SYS/5/meter-1/$state"));§Features
std(default): linksstd; impliesalloc.alloc:Command,LastWill,FilterLedger,RoleandPair.
Modules§
- filter
- Topic names and topic filters, per MQTT 3.1.1 section 4.7.
Structs§
- Filter
Ledger alloc - Refcounts per filter string, so that the subscriptions several holders share are subscribed once and unsubscribed only when the last holder lets go.
- Instant
- Milliseconds on the caller’s monotonic clock.
- Last
Will alloc - The Last Will and Testament a client registers when it connects.
- Message
- A message received from the broker, borrowed from the client’s buffer.
- Pair
alloc - Two roles on one link.
Enums§
- Command
alloc - Work for the MQTT client.
- Handled
- Whether a role took a received message.
- Link
- A change in the state of the connection to the broker.
- QoS
- MQTT quality of service level.
- Receipt
alloc - A broker or client report on a command already sent, for a host that
tracks delivery (a device built with
TreeConfig::receipts).
Traits§
- Role
alloc - One protocol role on an MQTT link: a sans-IO state machine fed with link changes, messages and the caller’s time, and drained of commands.