pub struct RawPacket {
pub header: FixedHeader,
pub payload: Bytes,
}Expand description
Represents a raw MQTT packet.
A raw packet consists of:
- A fixed header (
FixedHeader), which contains metadata about the packet. - A payload (
Bytes), which contains the variable header and payload data.
§Examples
use mqute_codec::codec::{RawPacket};
use mqute_codec::protocol::{FixedHeader, PacketType};
use bytes::Bytes;
let header = FixedHeader::new(PacketType::Publish, 4);
let payload = Bytes::from_static(&[0x00, 0x01, 0x02, 0x03]);
let packet = RawPacket::new(header, payload);Fields§
§header: FixedHeaderThe fixed header of the packet.
payload: BytesThe variable header and payload of the packet.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RawPacket
impl RefUnwindSafe for RawPacket
impl Send for RawPacket
impl Sync for RawPacket
impl Unpin for RawPacket
impl UnwindSafe for RawPacket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more