[][src]Struct mqttrs::Pid

pub struct Pid(_);

Packet Identifier.

For packets with QoS::AtLeastOne or QoS::ExactlyOnce delivery.

let pid = Pid::try_from(42).expect("illegal pid value");
let next_pid = pid + 1;
let pending_acks = std::collections::HashMap::<Pid, Packet>::new();

The spec (MQTT-2.3.1-1, MQTT-2.2.1-3) disallows a pid of 0.

Methods

impl Pid[src]

pub fn new() -> Self[src]

Returns a new Pid with value 1.

pub fn try_from(u: u16) -> Result<Self, Error>[src]

Returns a new Pid with specified value.

pub fn get(self) -> u16[src]

Get the Pid as a raw u16.

Trait Implementations

impl Clone for Pid[src]

impl Copy for Pid[src]

impl Eq for Pid[src]

impl Ord for Pid[src]

impl PartialEq<Pid> for Pid[src]

impl PartialOrd<Pid> for Pid[src]

impl Debug for Pid[src]

impl Sub<u16> for Pid[src]

type Output = Pid

The resulting type after applying the - operator.

impl Add<u16> for Pid[src]

type Output = Pid

The resulting type after applying the + operator.

impl Hash for Pid[src]

Auto Trait Implementations

impl Send for Pid

impl Sync for Pid

impl Unpin for Pid

impl UnwindSafe for Pid

impl RefUnwindSafe for Pid

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]