pub struct FixedHeader { /* private fields */ }Expand description
Packet type from a byte
7 3 0
+--------------------------+--------------------------+
byte 1 | MQTT Control Packet Type | Flags for each type |
+--------------------------+--------------------------+
| Remaining Bytes Len (1/2/3/4 bytes) |
+-----------------------------------------------------+
<https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349207>Implementations§
Source§impl FixedHeader
impl FixedHeader
pub const fn new( byte1: u8, remaining_len_len: usize, remaining_len: usize, ) -> FixedHeader
Sourcepub const fn packet_type(&self) -> Result<PacketType, Error>
pub const fn packet_type(&self) -> Result<PacketType, Error>
Returns the MQTT packet type represented by this fixed header.
§Errors
Returns an error if the fixed-header flags are invalid for the decoded packet type.
Sourcepub const fn frame_length(&self) -> usize
pub const fn frame_length(&self) -> usize
Returns the size of full packet (fixed header + variable header + payload) Fixed header is enough to get the size of a frame in the stream
Trait Implementations§
Source§impl Clone for FixedHeader
impl Clone for FixedHeader
Source§fn clone(&self) -> FixedHeader
fn clone(&self) -> FixedHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FixedHeader
impl Debug for FixedHeader
Source§impl PartialEq for FixedHeader
impl PartialEq for FixedHeader
Source§fn eq(&self, other: &FixedHeader) -> bool
fn eq(&self, other: &FixedHeader) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for FixedHeader
impl PartialOrd for FixedHeader
impl Copy for FixedHeader
impl Eq for FixedHeader
impl StructuralPartialEq for FixedHeader
Auto Trait Implementations§
impl Freeze for FixedHeader
impl RefUnwindSafe for FixedHeader
impl Send for FixedHeader
impl Sync for FixedHeader
impl Unpin for FixedHeader
impl UnsafeUnpin for FixedHeader
impl UnwindSafe for FixedHeader
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