symqtt-codec 0.1.0

MQTT 3.1.1/5.0 packet codec — role-neutral, runtime-free
Documentation
  • Coverage
  • 100%
    258 out of 258 items documented1 out of 9 items with examples
  • Size
  • Source code size: 297.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • zen1f/symqtt
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zen1f

symqtt-codec

MQTT 3.1.1 / 5.0 packet codec. Role-neutral, no async runtime.

Encode and decode packets without a client or broker. Packet::decode frames the stream: a partial packet returns Ok(None) and consumes nothing.

Usage

[dependencies]
symqtt-codec = "0.1"
bytes = "1"
use bytes::BytesMut;
use symqtt_codec::v3::{Packet, Subscribe, SubscribeFilter};
use symqtt_codec::QoS;

let mut wire = BytesMut::new();
Packet::Subscribe(Subscribe {
    pkid: 1,
    filters: vec![SubscribeFilter { topic: "a/b".to_owned(), qos: QoS::AtLeastOnce }],
})
.encode(&mut wire)?;

let packet = Packet::decode(&mut wire)?.expect("a whole packet");
# Ok::<(), Box<dyn std::error::Error>>(())
  • v3 — MQTT 3.1.1
  • v5 — MQTT 5.0 (properties, reason codes)

License

Licensed under Apache License, Version 2.0.