Struct PacketId
pub struct PacketId(NonZeroU16);Expand description
MQTT Packet Identifier (§2.2.1).
Packet identifiers are non-zero u16 values assigned to QoS > 0
PUBLISH, SUBSCRIBE, and UNSUBSCRIBE packets.
Tuple Fields§
§0: NonZeroU16Implementations§
§impl PacketId
impl PacketId
pub const MIN: Self
pub const MIN: Self
The smallest valid packet identifier (1).
pub const fn new(value: u16) -> Option<Self>
pub const fn new(value: u16) -> Option<Self>
Create a PacketId from a raw u16.
Returns None if the value is 0.
pub const fn as_non_zero(self) -> NonZeroU16
pub const fn as_non_zero(self) -> NonZeroU16
Return the underlying NonZeroU16.
pub const fn next(self) -> Self
pub const fn next(self) -> Self
Increment to the next packet ID, wrapping from 65535 back to 1.
Trait Implementations§
§impl From<NonZero<u16>> for PacketId
impl From<NonZero<u16>> for PacketId
§fn from(v: NonZeroU16) -> Self
fn from(v: NonZeroU16) -> Self
Converts to this type from the input type.
§impl From<PacketId> for NonZeroU16
impl From<PacketId> for NonZeroU16
§impl Ord for PacketId
impl Ord for PacketId
§impl PartialOrd for PacketId
impl PartialOrd for PacketId
impl Copy for PacketId
impl Eq for PacketId
impl StructuralPartialEq for PacketId
Auto Trait Implementations§
impl Freeze for PacketId
impl RefUnwindSafe for PacketId
impl Send for PacketId
impl Sync for PacketId
impl Unpin for PacketId
impl UnwindSafe for PacketId
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