pub struct FixedHeader { /* private fields */ }Expand description
Fixed header part of a mqtt control packet. It consists of as least two bytes.
7 6 5 4 3 2 1 0
+-------+-------+
| Type | Flags |
+-------+-------+
| Remaining Len |
+-------+-------+Implementations§
Source§impl FixedHeader
impl FixedHeader
Sourcepub fn new(
packet_type: PacketType,
remaining_length: usize,
) -> Result<Self, VarIntError>
pub fn new( packet_type: PacketType, remaining_length: usize, ) -> Result<Self, VarIntError>
Create a new fixed header with packet_type and remaining_length.
§Errors
Returns error if remaining_length is invalid.
pub const fn packet_type(&self) -> PacketType
pub const fn remaining_length(&self) -> usize
Sourcepub fn is_valid_header(&self, protocol_level: ProtocolLevel) -> bool
pub fn is_valid_header(&self, protocol_level: ProtocolLevel) -> bool
Check whether this fixed header is valid within specific protocol_level.
Note that Auth packet is only available in MQTT 5.0.
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 · 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 DecodePacket for FixedHeader
impl DecodePacket for FixedHeader
Source§impl Default for FixedHeader
impl Default for FixedHeader
Source§fn default() -> FixedHeader
fn default() -> FixedHeader
Returns the “default value” for a type. Read more
Source§impl EncodePacket for FixedHeader
impl EncodePacket for FixedHeader
Source§impl PartialEq for FixedHeader
impl PartialEq 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 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