4 releases
0.1.3 | May 25, 2024 |
---|---|
0.1.2 | Mar 16, 2024 |
0.1.1 | Mar 16, 2024 |
0.1.0 | Mar 16, 2024 |
#967 in Encoding
175KB
4.5K
SLoC
MQTT v5 serialization and deserialization
This is a low level crate with the ability to assemble and disassemble MQTT 5 packets and is used by both client and broker. Uses 'bytes' crate internally
License: Apache-2.0
Based on rumqttc
Usage
use bytes::BytesMut;
use mqtt_bytes_v5::{Packet, PubAck, PubAckReason, Error};
let mut buf: BytesMut = BytesMut::new();
let packet = Packet::PubAck(PubAck {
pkid: 42,
reason: PubAckReason::Success,
properties: None,
});
let result: Result<usize, Error> = packet.write(&mut buf);
let result: Result<Packet, Error> = Packet::read(&mut buf, None);
Features
Configurable MqttString type:
default
- usesString
for MqttStringboxed_string
- usesBox<str>
for MqttStringbinary_string
- usesbytes::Bytes
for MqttString (about 20% faster thanString
)
License
This project is released under The Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
Dependencies
~0.4–1MB
~20K SLoC