Skip to main content

Event

Enum Event 

Source
pub enum Event<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> {
    Pingresp,
    Publish(Publish<'e, MAX_SUBSCRIPTION_IDENTIFIERS>),
    Suback(Suback),
    Unsuback(Suback),
    PublishRejected(Pubrej),
    PublishAcknowledged(Puback),
    PublishReceived(Puback),
    PublishReleased(Puback),
    PublishComplete(Puback),
    Ignored,
    Duplicate,
}
Expand description

Events emitted by the client when receiving an MQTT packet.

Variants§

§

Pingresp

The server sent a PINGRESP packet.

§

Publish(Publish<'e, MAX_SUBSCRIPTION_IDENTIFIERS>)

The server sent a PUBLISH packet.

The client has acted as follows:

  • QoS 0: No action
  • QoS 1: A PUBACK packet has been sent to the server.
  • QoS 2: A PUBREC packet has been sent to the server and the packet identifier is tracked as in flight
§

Suback(Suback)

The server sent a SUBACK packet matching a SUBSCRIBE packet.

The subscription process is complete and was successful if the reason code indicates success. The SUBSCRIBE packet won’t have to be resent.

§

Unsuback(Suback)

The server sent an UNSUBACK packet matching an UNSUBSCRIBE packet.

The unsubscription process is complete and was successful if the reason code indicates success. The UNSUBSCRIBE packet won’t have to be resent.

§

PublishRejected(Pubrej)

The server sent a PUBACK or PUBREC with an erroneous reason code, therefore rejecting the publication.

The included reason code is always erroneous.

The publication process is aborted.

§

PublishAcknowledged(Puback)

The server sent a PUBACK packet matching a QoS 1 PUBLISH packet confirming that the PUBLISH has been received.

The included reason code is always successful.

The QoS 1 publication process is complete, the PUBLISH packet won’t have to be resent.

§

PublishReceived(Puback)

The server sent a PUBREC packet matching a QoS 2 PUBLISH packet confirming that the PUBLISH has been received.

The included reason code is always successful.

The client has responded with a PUBREL packet.

The first handshake of the QoS 2 publication process is complete, the PUBLISH packet won’t have to be resent.

§

PublishReleased(Puback)

The server sent a PUBREL packet matching a QoS 2 PUBREC packet confirming that the PUBREC has been received.

The included reason code is always successful.

The client has responded with a PUBCOMP packet.

The QoS 2 publication process is complete, the PUBREC packet won’t have to be resent.

§

PublishComplete(Puback)

The server sent a PUBCOMP packet matching a QoS 2 PUBREL packet confirming that the PUBREL has been received.

The included reason code is always successful.

The QoS 2 publication process is complete, the PUBREL packet won’t have to be resent.

§

Ignored

The server sent a SUBACK, PUBACK, PUBREC, PUBREL or PUBCOMP packet with a packet identifier that is not in flight (anymore).

The client has not responded to the server or has responded appropriately to prevent a potential protocol deadlock.

§

Duplicate

The server sent a QoS 2 PUBLISH packet which would cause a duplicate.

The client has responded with a PUBREC packet.

Trait Implementations§

Source§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> Debug for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> Freeze for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> RefUnwindSafe for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> Send for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> Sync for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> Unpin for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> UnsafeUnpin for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

§

impl<'e, const MAX_SUBSCRIPTION_IDENTIFIERS: usize> UnwindSafe for Event<'e, MAX_SUBSCRIPTION_IDENTIFIERS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.