Crates.io | mqtt-bytes-v5 |
lib.rs | mqtt-bytes-v5 |
version | 0.1.3 |
source | src |
created_at | 2024-03-16 15:18:59.112702 |
updated_at | 2024-05-25 07:33:13.687075 |
description | MQTT v5 serialization and deserialization |
homepage | https://github.com/alfredotg/mqtt-bytes-v5 |
repository | https://github.com/alfredotg/mqtt-bytes-v5 |
max_upload_size | |
id | 1175696 |
size | 188,420 |
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
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);
Configurable MqttString type:
default
- uses String
for MqttStringboxed_string
- uses Box<str>
for MqttStringbinary_string
- uses bytes::Bytes
for MqttString (about 20% faster than String
)This project is released under The Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)