Enum mqttrust_core::Packet
source · [−]pub enum Packet<'a> {
}
Expand description
Base enum for all MQTT packet types.
This is the main type you’ll be interacting with, as an output of decode_slice()
and an input of
encode()
. Most variants can be constructed directly without using methods.
// Simplest form
let pkt = Packet::Connack(Connack { session_present: false,
code: ConnectReturnCode::Accepted });
// Using `Into` trait
let publish = Publish { dup: false,
qos: QoS::AtMostOnce,
retain: false,
pid: None,
topic_name: "to/pic",
payload: b"payload" };
let pkt: Packet = publish.into();
// Identifyer-only packets
let pkt = Packet::Puback(Pid::try_from(42).unwrap());
Variants
Connect(Connect<'a>)
Connack(Connack)
Publish(Publish<'a>)
Puback(Pid)
Pubrec(Pid)
Pubrel(Pid)
Pubcomp(Pid)
Subscribe(Subscribe<'a>)
Suback(Suback<'a>)
Unsubscribe(Unsubscribe<'a>)
Unsuback(Pid)
Pingreq
Pingresp
Disconnect
Implementations
Trait Implementations
sourceimpl<'a> From<Unsubscribe<'a>> for Packet<'a>
impl<'a> From<Unsubscribe<'a>> for Packet<'a>
sourcefn from(p: Unsubscribe<'a>) -> Packet<'a>
fn from(p: Unsubscribe<'a>) -> Packet<'a>
Converts to this type from the input type.
impl<'a> StructuralPartialEq for Packet<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for Packet<'a>
impl<'a> Send for Packet<'a>
impl<'a> Sync for Packet<'a>
impl<'a> Unpin for Packet<'a>
impl<'a> UnwindSafe for Packet<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more