Enum ReasonCode
#[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
All MQTT v5 reason codes.
Variants§
Success = 0
Operation completed successfully (0x00).
GrantedQoS1 = 1
Granted maximum QoS 1 (0x01).
GrantedQoS2 = 2
Granted maximum QoS 2 (0x02).
DisconnectWithWillMessage = 4
Disconnect with will message (0x04).
NoMatchingSubscribers = 16
No matching subscribers (0x10).
NoSubscriptionExisted = 17
No subscription existed (0x11).
ContinueAuthentication = 24
Continue authentication (0x18).
ReAuthenticate = 25
Re-authenticate (0x19).
UnspecifiedError = 128
Unspecified error (0x80).
MalformedPacket = 129
Malformed packet (0x81).
ProtocolError = 130
Protocol error (0x82).
ImplementationSpecificError = 131
Implementation specific error (0x83).
UnsupportedProtocolVersion = 132
Unsupported protocol version (0x84).
ClientIdentifierNotValid = 133
Client identifier not valid (0x85).
BadUserNameOrPassword = 134
Bad user name or password (0x86).
NotAuthorized = 135
Not authorized (0x87).
Server unavailable (0x88).
ServerBusy = 137
Server busy (0x89).
Banned = 138
Banned (0x8A).
ServerShuttingDown = 139
Server shutting down (0x8B).
BadAuthenticationMethod = 140
Bad authentication method (0x8C).
KeepAliveTimeout = 141
Keep alive timeout (0x8D).
SessionTakenOver = 142
Session taken over (0x8E).
TopicFilterInvalid = 143
Topic filter invalid (0x8F).
TopicNameInvalid = 144
Topic name invalid (0x90).
PacketIdentifierInUse = 145
Packet identifier in use (0x91).
PacketIdentifierNotFound = 146
Packet identifier not found (0x92).
ReceiveMaximumExceeded = 147
Receive maximum exceeded (0x93).
TopicAliasInvalid = 148
Topic alias invalid (0x94).
PacketTooLarge = 149
Packet too large (0x95).
MessageRateTooHigh = 150
Message rate too high (0x96).
QuotaExceeded = 151
Quota exceeded (0x97).
AdministrativeAction = 152
Administrative action (0x98).
PayloadFormatInvalid = 153
Payload format invalid (0x99).
RetainNotSupported = 154
Retain not supported (0x9A).
QoSNotSupported = 155
QoS not supported (0x9B).
UseAnotherServer = 156
Use another server (0x9C).
ServerMoved = 157
Server moved (0x9D).
Shared subscriptions not supported (0x9E).
ConnectionRateExceeded = 159
Connection rate exceeded (0x9F).
MaximumConnectTime = 160
Maximum connect time (0xA0).
SubscriptionIdentifiersNotSupported = 161
Subscription identifiers not supported (0xA1).
WildcardSubscriptionsNotSupported = 162
Wildcard subscriptions not supported (0xA2).
Implementations§
Source§impl ReasonCode
impl ReasonCode
Sourcepub const fn from_u8(v: u8) -> Option<ReasonCode>
pub const fn from_u8(v: u8) -> Option<ReasonCode>
Converts a raw byte to a reason code, returning None if unknown.
Sourcepub const fn is_error(self) -> bool
pub const fn is_error(self) -> bool
Returns whether this reason code indicates an error (>= 0x80).
Sourcepub const fn confirms_subscription(self) -> bool
pub const fn confirms_subscription(self) -> bool
Returns whether a SUBACK reason code grants the subscription (§3.9.3).
A granted code is any non-error code (< 0x80): Success,
GrantedQoS1, or GrantedQoS2.
Sourcepub const fn confirms_unsubscription(self) -> bool
pub const fn confirms_unsubscription(self) -> bool
Returns whether an UNSUBACK reason code confirms the removal (§3.11.3).
Only Success and NoSubscriptionExisted remove the stored
subscription; any other code leaves it in place.
Sourcepub const fn slice_from_bytes(
bytes: &[u8],
) -> Result<&[ReasonCode], DecodeError>
pub const fn slice_from_bytes( bytes: &[u8], ) -> Result<&[ReasonCode], DecodeError>
Validates wire bytes as a slice of reason codes.
§Errors
Returns DecodeError::InvalidValue if any byte is not a known
reason code.
Sourcepub const fn slice_as_bytes(codes: &[ReasonCode]) -> &[u8] ⓘ
pub const fn slice_as_bytes(codes: &[ReasonCode]) -> &[u8] ⓘ
Reinterprets a slice of reason codes as its wire bytes.
Trait Implementations§
Source§impl Clone for ReasonCode
impl Clone for ReasonCode
Source§fn clone(&self) -> ReasonCode
fn clone(&self) -> ReasonCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReasonCode
impl Debug for ReasonCode
Source§impl Hash for ReasonCode
impl Hash for ReasonCode
Source§impl PartialEq for ReasonCode
impl PartialEq for ReasonCode
impl Copy for ReasonCode
impl Eq for ReasonCode
impl StructuralPartialEq for ReasonCode
Auto Trait Implementations§
impl Freeze for ReasonCode
impl RefUnwindSafe for ReasonCode
impl Send for ReasonCode
impl Sync for ReasonCode
impl Unpin for ReasonCode
impl UnwindSafe for ReasonCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more