Skip to main content

ReasonCode

Enum ReasonCode 

Source
#[repr(u8)]
pub enum ReasonCode {
Show 43 variants Success = 0, GrantedQoS1 = 1, GrantedQoS2 = 2, DisconnectWithWillMessage = 4, NoMatchingSubscribers = 16, NoSubscriptionExisted = 17, ContinueAuthentication = 24, ReAuthenticate = 25, UnspecifiedError = 128, MalformedPacket = 129, ProtocolError = 130, ImplementationSpecificError = 131, UnsupportedProtocolVersion = 132, ClientIdentifierNotValid = 133, BadUserNameOrPassword = 134, NotAuthorized = 135, ServerUnavailable = 136, ServerBusy = 137, Banned = 138, ServerShuttingDown = 139, BadAuthenticationMethod = 140, KeepAliveTimeout = 141, SessionTakenOver = 142, TopicFilterInvalid = 143, TopicNameInvalid = 144, PacketIdentifierInUse = 145, PacketIdentifierNotFound = 146, ReceiveMaximumExceeded = 147, TopicAliasInvalid = 148, PacketTooLarge = 149, MessageRateTooHigh = 150, QuotaExceeded = 151, AdministrativeAction = 152, PayloadFormatInvalid = 153, RetainNotSupported = 154, QoSNotSupported = 155, UseAnotherServer = 156, ServerMoved = 157, SharedSubscriptionsNotSupported = 158, ConnectionRateExceeded = 159, MaximumConnectTime = 160, SubscriptionIdentifiersNotSupported = 161, WildcardSubscriptionsNotSupported = 162,
}
Expand description

A Reason Code is a variable byte integer encoded value that indicates the result of an operation.

The CONNACK, PUBACK, PUBREC, PUBREL, PUBCOMP, DISCONNECT and AUTH Control Packets have a single Reason Code as part of the Variable Header. The SUBACK and UNSUBACK packets contain a list of one or more Reason Codes in the Payload.

Variants§

§

Success = 0

§aka GrantedQoS0, NormalDisconnection

CONNACK, PUBACK, PUBREC, PUBREL, PUBCOMP, SUBACK, UNSUBACK, AUTH, DISCONNECT

§

GrantedQoS1 = 1

SUBACK

§

GrantedQoS2 = 2

SUBACK

§

DisconnectWithWillMessage = 4

DISCONNECT

§

NoMatchingSubscribers = 16

PUBACK, PUBREC

§

NoSubscriptionExisted = 17

UNSUBACK

§

ContinueAuthentication = 24

AUTH

§

ReAuthenticate = 25

AUTH

§

UnspecifiedError = 128

CONNACK, PUBACK, PUBREC, SUBACK, UNSUBACK, DISCONNECT

§

MalformedPacket = 129

CONNACK, DISCONNECT

§

ProtocolError = 130

CONNACK, DISCONNECT

§

ImplementationSpecificError = 131

CONNACK, PUBACK, PUBREC, SUBACK, UNSUBACK, DISCONNECT

§

UnsupportedProtocolVersion = 132

CONNACK

§

ClientIdentifierNotValid = 133

CONNACK

§

BadUserNameOrPassword = 134

CONNACK

§

NotAuthorized = 135

CONNACK, PUBACK, PUBREC, SUBACK, UNSUBACK, DISCONNECT

§

ServerUnavailable = 136

CONNACK

§

ServerBusy = 137

CONNACK, DISCONNECT

§

Banned = 138

CONNACK

§

ServerShuttingDown = 139

DISCONNECT

§

BadAuthenticationMethod = 140

CONNACK, DISCONNECT

§

KeepAliveTimeout = 141

DISCONNECT

§

SessionTakenOver = 142

DISCONNECT

§

TopicFilterInvalid = 143

SUBACK, UNSUBACK, DISCONNECT

§

TopicNameInvalid = 144

CONNACK, PUBACK, PUBREC, DISCONNECT

§

PacketIdentifierInUse = 145

PUBACK, PUBREC, SUBACK, UNSUBACK

§

PacketIdentifierNotFound = 146

PUBREL, PUBCOMP

§

ReceiveMaximumExceeded = 147

DISCONNECT

§

TopicAliasInvalid = 148

DISCONNECT

§

PacketTooLarge = 149

CONNACK, DISCONNECT

§

MessageRateTooHigh = 150

DISCONNECT

§

QuotaExceeded = 151

CONNACK, PUBACK, PUBREC, SUBACK, DISCONNECT

§

AdministrativeAction = 152

DISCONNECT

§

PayloadFormatInvalid = 153

CONNACK, PUBACK, PUBREC, DISCONNECT

§

RetainNotSupported = 154

CONNACK, DISCONNECT

§

QoSNotSupported = 155

CONNACK, DISCONNECT

§

UseAnotherServer = 156

CONNACK, DISCONNECT

§

ServerMoved = 157

CONNACK, DISCONNECT

§

SharedSubscriptionsNotSupported = 158

SUBACK, DISCONNECT

§

ConnectionRateExceeded = 159

CONNACK, DISCONNECT

§

MaximumConnectTime = 160

DISCONNECT

§

SubscriptionIdentifiersNotSupported = 161

SUBACK, DISCONNECT

§

WildcardSubscriptionsNotSupported = 162

SUBACK, DISCONNECT

Implementations§

Source§

impl ReasonCode

Source

pub const fn value(self) -> u8

Returns the numeric value of the reason code.

Source

pub const fn is_success(&self) -> bool

Returns whether the reason code is successful. This is the case if the reason code’s numeric value is less than 0x80.

Source

pub const fn is_erroneous(&self) -> bool

Returns whether the reason code indicates an error. This is the case if the reason code’s numeric value is greater than or equal to 0x80.

Trait Implementations§

Source§

impl Clone for ReasonCode

Source§

fn clone(&self) -> ReasonCode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReasonCode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ReasonCode

Source§

fn default() -> ReasonCode

Returns the “default value” for a type. Read more
Source§

impl PartialEq for ReasonCode

Source§

fn eq(&self, other: &ReasonCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ReasonCode

Source§

impl Eq for ReasonCode

Source§

impl StructuralPartialEq for ReasonCode

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.