[−][src]Enum mqttrs::Packet
Base enum for all MQTT packet types.
This is the main type you'll be interacting with, as an output of decode()
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, qospid: QosPid::AtMostOnce, retain: false, topic_name: "to/pic".into(), payload: "payload".into() }; let pkt: Packet = publish.into(); // Identifyer-only packets let pkt = Packet::Puback(Pid::try_from(42).unwrap());
Variants
Connect(Connect)
Connack(Connack)
Publish(Publish)
Puback(Pid)
Pubrec(Pid)
Pubrel(Pid)
Pubcomp(Pid)
Subscribe(Subscribe)
Suback(Suback)
Unsubscribe(Unsubscribe)
Unsuback(Pid)
Methods
impl Packet
[src]
pub fn get_type(&self) -> PacketType
[src]
Return the packet type variant.
This can be used for matching, categorising, debuging, etc. Most users will match directly
on Packet
instead.
Trait Implementations
impl Clone for Packet
[src]
impl Debug for Packet
[src]
impl From<Connack> for Packet
[src]
impl From<Connect> for Packet
[src]
impl From<Publish> for Packet
[src]
impl From<Suback> for Packet
[src]
impl From<Subscribe> for Packet
[src]
impl From<Unsubscribe> for Packet
[src]
fn from(p: Unsubscribe) -> Self
[src]
impl PartialEq<Packet> for Packet
[src]
impl StructuralPartialEq for Packet
[src]
Auto Trait Implementations
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,