ReasonCode

Enum ReasonCode 

Source
pub enum ReasonCode {
Show 45 variants Success, NormalDisconnection, GrantedQos0, GrantedQos1, GrantedQos2, DisconnectWithWillMessage, NoMatchingSubscribers, NoSubscriptionExisted, ContinueAuthentication, ReAuthenticate, UnspecifiedError, MalformedPacket, ProtocolError, ImplementationSpecificError, UnsupportedProtocolVersion, ClientIdentifierNotValid, BadUserNameOrPassword, NotAuthorized, ServerUnavailable, ServerBusy, Banned, ServerShuttingDown, BadAuthenticationMethod, KeepAliveTimeout, SessionTakenOver, TopicFilterInvalid, TopicNameInvalid, PacketIdentifierInUse, PacketIdentifierNotFound, ReceiveMaximumExceeded, TopicAliasInvalid, PacketTooLarge, MessageRateTooHigh, QuotaExceeded, AdministrativeAction, PayloadFormatInvalid, RetainNotSupported, QosNotSupported, UseAnotherServer, ServerMoved, SharedSubscriptionsNotSupported, ConnectionRateExceeded, MaximumConnectTime, SubscriptionIdentifiersNotSupported, WildcardSubscriptionsNotSupported,
}
Expand description

Represents all possible reason codes in MQTT v5 protocol.

Reason codes are used in various MQTT packets to indicate the result of operations or the reason for disconnections. Each variant corresponds to a specific numeric code as defined in the MQTT v5 specification.

Variants§

§

Success

Success (0x00)

§

NormalDisconnection

Normal disconnection (0x00)

§

GrantedQos0

Granted QoS 0 (0x00)

§

GrantedQos1

Granted QoS 1 (0x01)

§

GrantedQos2

Granted QoS 2 (0x02)

§

DisconnectWithWillMessage

Disconnect with Will Message (0x04)

§

NoMatchingSubscribers

No matching subscribers (0x10)

§

NoSubscriptionExisted

No subscription existed (0x11)

§

ContinueAuthentication

Continue authentication (0x18)

§

ReAuthenticate

Re-authenticate (0x19)

§

UnspecifiedError

Unspecified error (0x80)

§

MalformedPacket

Malformed Packet (0x81)

§

ProtocolError

Protocol Error (0x82)

§

ImplementationSpecificError

Implementation specific error (0x83)

§

UnsupportedProtocolVersion

Unsupported Protocol Version (0x84)

§

ClientIdentifierNotValid

Client Identifier not valid (0x85)

§

BadUserNameOrPassword

Bad User Name or Password (0x86)

§

NotAuthorized

Not authorized (0x87)

§

ServerUnavailable

Server unavailable (0x88)

§

ServerBusy

Server busy (0x89)

§

Banned

Banned (0x8A)

§

ServerShuttingDown

Server shutting down (0x8B)

§

BadAuthenticationMethod

Bad authentication method (0x8C)

§

KeepAliveTimeout

Keep Alive timeout (0x8D)

§

SessionTakenOver

Session taken over (0x8E)

§

TopicFilterInvalid

Topic Filter invalid (0x8F)

§

TopicNameInvalid

Topic Name invalid (0x90)

§

PacketIdentifierInUse

Packet Identifier in use (0x91)

§

PacketIdentifierNotFound

Packet Identifier not found (0x92)

§

ReceiveMaximumExceeded

Receive Maximum exceeded (0x93)

§

TopicAliasInvalid

Topic Alias invalid (0x94)

§

PacketTooLarge

Packet too large (0x95)

§

MessageRateTooHigh

Message rate too high (0x96)

§

QuotaExceeded

Quota exceeded (0x97)

§

AdministrativeAction

Administrative action (0x98)

§

PayloadFormatInvalid

Payload format invalid (0x99)

§

RetainNotSupported

Retain not supported (0x9A)

§

QosNotSupported

QoS not supported (0x9B)

§

UseAnotherServer

Use another server (0x9C)

§

ServerMoved

Server moved (0x9D)

§

SharedSubscriptionsNotSupported

Shared Subscriptions not supported (0x9E)

§

ConnectionRateExceeded

Connection rate exceeded (0x9F)

§

MaximumConnectTime

Maximum connect time (0xA0)

§

SubscriptionIdentifiersNotSupported

Subscription Identifiers not supported (0xA1)

§

WildcardSubscriptionsNotSupported

Wildcard Subscriptions not supported (0xA2)

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 Display for ReasonCode

Source§

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

Provides human-readable display for reason codes.

§Example
use mqute_codec::protocol::v5::ReasonCode;
let str = format!("{}", ReasonCode::ProtocolError);
let text = "Protocol Error".to_string();
assert_eq!(text, str);
Source§

impl From<ReasonCode> for u8

Source§

fn from(value: ReasonCode) -> Self

Converts a ReasonCode to its numeric representation.

§Example
use mqute_codec::protocol::v5::ReasonCode;

let code: u8 = ReasonCode::GrantedQos1.into();
assert_eq!(code, 1);
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 TryFrom<u8> for ReasonCode

Source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Attempts to convert a numeric value to a ReasonCode.

§Example
use mqute_codec::protocol::v5::ReasonCode;

let code = ReasonCode::try_from(0x85).unwrap();
assert_eq!(code, ReasonCode::ClientIdentifierNotValid);
Source§

type Error = Error

The type returned in the event of a conversion error.
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> 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.