ReasonCode

Enum ReasonCode 

#[repr(u8)]
pub enum ReasonCode {
Show 44 variants Success = 0, GrantedQos1 = 1, GrantedQos2 = 2, DisconnectWithWillMessage = 4, NoMatchingSubscribers = 16, NoSubscriptionFound = 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, MqttppV3Code = 255,
}
Expand description

MQTT v5 single-byte reason codes.

Variants§

§

Success = 0

The operation completed successfully. Also used as NormalDisconnection and GrantedQos0.

§

GrantedQos1 = 1

The subscription was accepted and the maximum QoS sent will be 1.

§

GrantedQos2 = 2

The subscription was accepted and the maximum QoS sent will be 2.

§

DisconnectWithWillMessage = 4

The client wishes to disconnect but requires that the server also publishes its Will message.

§

NoMatchingSubscribers = 16

The message was accepted but there are no subscribers. Only sent by the broker if the broker was configured to send this when there are no matching subscribers.

§

NoSubscriptionFound = 17

No matching topic filter is being used by the client. Only sent by the broker in response to an UNSUBSCRIBE packet.

§

ContinueAuthentication = 24

Continue the authentication with another step.

§

ReAuthenticate = 25

Initiate re-authentication.

§

UnspecifiedError = 128

The server does not wish to reveal the reason for the failure, or none of the other reason codes apply.

§

MalformedPacket = 129

Data within the packet could not be correctly parsed.

§

ProtocolError = 130

Data in the packet does not conform to the MQTT specification.

§

ImplementationSpecificError = 131

An operation is not accepted and the server is not willing to reveal the reason.

§

UnsupportedProtocolVersion = 132

The server does not support the version of the MQTT protocol requested by the client.

§

ClientIdentifierNotValid = 133

The client identifier is a valid string but is not allowed by the server.

§

BadUserNameOrPassword = 134

The server does not accept the user name or password specified by the client.

§

NotAuthorized = 135

The request is not authorized.

§

ServerUnavailable = 136

The MQTT server is not available.

§

ServerBusy = 137

The server is busy. Try again later.

§

Banned = 138

This client has been banned by administrative action. Contact the server operator.

§

ServerShuttingDown = 139

The server is shutting down.

§

BadAuthenticationMethod = 140

The authentication method is not supported or does not match the authentication method currently in use.

§

KeepAliveTimeout = 141

The connection is closed because no packet has been received for 1.5x the keep-alive time.

§

SessionTakenOver = 142

Another connection using the same client ID has connected, causing this connection to be closed.

§

TopicFilterInvalid = 143

The topic filter format is not allowed by the server.

§

TopicNameInvalid = 144

The topic name is not accepted by the client or server.

§

PacketIdentifierInUse = 145

The packet identifier is already in use. This might indicate a mismatch in the session state between the client and server.

§

PacketIdentifierNotFound = 146

The packet identifier is not known. This is not an error during recovery; it is a sign of mismatch between the session state on the client and server.

§

ReceiveMaximumExceeded = 147

The client or server has received more than the receive maximum it sent in the CONNECT or CONNACK packet.

§

TopicAliasInvalid = 148

The topic alias was greater than the maximum topic alias sent in the CONNECT or CONNACK packet.

§

PacketTooLarge = 149

The packet size is greater than the maximum packet size for this client or server.

§

MessageRateTooHigh = 150

The received data rate is too high.

§

QuotaExceeded = 151

An implementation or administrative imposed limit has been exceeded.

§

AdministrativeAction = 152

The connection is closed due to an administrative action.

§

PayloadFormatInvalid = 153

The payload format does not match the one specified in the payload format indicator.

§

RetainNotSupported = 154

The server does not support retained messages.

§

QosNotSupported = 155

The client specified a QoS greater than the QoS specified in a maximum QoS in the CONNACK.

§

UseAnotherServer = 156

The client should temporarily use another server.

§

ServerMoved = 157

The client should permanently use another server.

§

SharedSubscriptionsNotSupported = 158

The server does not support shared subscriptions.

§

ConnectionRateExceeded = 159

The connection rate limit has been exceeded.

§

MaximumConnectTime = 160

The maximum connection time authorized for this connection has been exceeded.

§

SubscriptionIdentifiersNotSupported = 161

The server does not support subscription identifiers. The subscription is not accepted.

§

WildcardSubscriptionsNotSupported = 162

The server does not support wildcard subscriptions; the subscription is not accepted.

§

MqttppV3Code = 255

Not a protocol-defined reason code. Used internally by the Paho C library for MQTT v3 error codes.

Implementations§

§

impl ReasonCode

pub const NormalDisconnection: ReasonCode = ReasonCode::Success

Reason code for a normal disconnect

pub const GrantedQos0: ReasonCode = ReasonCode::Success

Reason code for QoS 0 granted

§

impl ReasonCode

pub fn is_ok(&self) -> bool

Reason codes less than 0x80 indicate a successful operation.

pub fn is_err(&self) -> bool

Reason codes of 0x80 or greater indicate failure.

Trait Implementations§

§

impl Clone for ReasonCode

§

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
§

impl Debug for ReasonCode

§

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

Formats the value using the given formatter. Read more
§

impl Default for ReasonCode

§

fn default() -> ReasonCode

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

impl Display for ReasonCode

§

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

Formats the value using the given formatter. Read more
§

impl From<u32> for ReasonCode

§

fn from(code: u32) -> ReasonCode

Converts to this type from the input type.
§

impl Hash for ReasonCode

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl Ord for ReasonCode

§

fn cmp(&self, other: &ReasonCode) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl PartialEq for ReasonCode

§

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.
§

impl PartialOrd for ReasonCode

§

fn partial_cmp(&self, other: &ReasonCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl Copy for ReasonCode

§

impl Eq for ReasonCode

§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more