Error

Enum Error 

pub enum Error {
Show 36 variants Failure, PersistenceError, Disconnected, MaxMessagesInflight, BadUtf8String, NullParameter, TopicNameTruncated, BadStructure, BadQos, NoMoreMsgIds, OperationIncomplete, MaxBufferedMessages, SslNotSupported, BadProtocol, BadMqttOption, WrongMqttVersion, ZeroLenWillTopic, CommandIgnored, MaxBufferedZero, TcpConnectTimeout, TcpConnectCompletionFailure, TcpTlsConnectFailure, SocketError(i32), ConnectReturn(ConnectReturnCode), ReceivedDisconnect(i32), Publish(i32, Message), ReasonCode(ReasonCode, Properties), BadTopicFilter, Io(Error), Utf8(Utf8Error), Nul(NulError), MissingSslOptions, Conversion, Timeout, General(&'static str), GeneralString(String),
}
Expand description

The errors from an MQTT operation.

Variants§

§

Failure

A generic error code indicating the failure of an MQTT client operation.

§

PersistenceError

Persistence error

§

Disconnected

The client is disconnected.

§

MaxMessagesInflight

The maximum number of messages allowed to be simultaneously in-flight has been reached.

§

BadUtf8String

An invalid UTF-8 string has been detected.

§

NullParameter

A NULL parameter has been supplied to the underlying C library when this is invalid.

§

TopicNameTruncated

The topic has been truncated (the topic string includes embedded NULL characters). String functions will not access the full topic. Use the topic length value to access the full topic.

§

BadStructure

A structure parameter passed down to the C library does not have the correct eyecatcher and version number.

§

BadQos

An invaid QoS value was used not 0, 1, or 2)

§

NoMoreMsgIds

All 64k MQTT message ID are currently in use

§

OperationIncomplete

The request is being discarded when not complete

§

MaxBufferedMessages

The limit on the maximum number of message buffers has been reached.

§

SslNotSupported

Attempting SSL connection using non-SSL version of library.

§

BadProtocol

A bad URL protocol/schema was requested/ Note that the TLS enabled prefixes (ssl, mqtts, wss) are only valid if the TLS version of the library is linked int the app.

§

BadMqttOption

Don’t use options for another version of MQTT

§

WrongMqttVersion

Call not applicable to the client’s version of MQTT

§

ZeroLenWillTopic

The LWT topic can not be zero length

§

CommandIgnored

Connect or disconnect command ignored because there is already a connect or disconnect command at the head of the list waiting to be processed. Use the onSuccess/onFailure callbacks to wait for the previous connect or disconnect command to be complete.

§

MaxBufferedZero

The max number of buffered messages can not be zero. The library needs at least one slot for the outbound message.

§

TcpConnectTimeout

The TCP connection timed out

§

TcpConnectCompletionFailure

The TCP connection failed to complete

§

TcpTlsConnectFailure

TCP/TLS connection failure

§

SocketError(i32)

A socket error occurred

§

ConnectReturn(ConnectReturnCode)

§

ReceivedDisconnect(i32)

§

Publish(i32, Message)

A synchronous error when publishing creating or queuing the message.

§

ReasonCode(ReasonCode, Properties)

An MQTT v5 error from a reason code. Any reason code >= 0x80 indicates an error.

§

BadTopicFilter

A bad topic filter

§

Io(Error)

An low-level I/O error

§

Utf8(Utf8Error)

An error parsing a UTF-8 string

§

Nul(NulError)

A string NUL error

§

MissingSslOptions

Missing SSL/TLS options

§

Conversion

Conversion error between types

§

Timeout

A timeout, particularly from a synchronous operation.

§

General(&'static str)

A general error with description

§

GeneralString(String)

A general error with description

Implementations§

§

impl Error

pub fn from_return_code(rc: i32) -> Error

Create an error from a Paho C return code.

These should not be confused with Connect Return Codes (v3.x) or Reason Codes (v5), although the C lib is sometimes vague about which integer value it is returning.

pub fn from_connect_return_code(code: u8) -> Error

Create an error from an MQTT v3 Connect Return Code

pub fn from_reason_code(code: u8, props: Properties) -> Error

Create an error from an MQTT v5 Reason Code and properties

Trait Implementations§

§

impl Debug for Error

§

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

Formats the value using the given formatter. Read more
§

impl Display for Error

§

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

Formats the value using the given formatter. Read more
§

impl Error for Error

§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
§

impl From<&'static str> for Error

§

fn from(descr: &'static str) -> Error

Create a general error from a string.

§

impl From<(i32, &str)> for Error

§

fn from(_: (i32, &str)) -> Error

Convert a Paho C return code w/ reason string to an Error.

The Paho C library passes up error description strings that are supposed to be for “additional” information, but they actually describe specific errors that should have been enumerated. This is somewhat of a hack to use the string to enumerate errors. These strings are pulled directly from the C sources, and could change.

§

impl From<(i32, Option<String>)> for Error

§

fn from(_: (i32, Option<String>)) -> Error

Converts to this type from the input type.
§

impl From<Error> for Error

§

fn from(source: Error) -> Error

Converts to this type from the input type.
§

impl From<IntoStringError> for Error

§

fn from(_: IntoStringError) -> Error

Converts to this type from the input type.
§

impl From<NulError> for Error

§

fn from(source: NulError) -> Error

Converts to this type from the input type.
§

impl From<String> for Error

§

fn from(descr: String) -> Error

Create a general error from a string.

§

impl From<Utf8Error> for Error

§

fn from(source: Utf8Error) -> Error

Converts to this type from the input type.
§

impl From<i32> for Error

§

fn from(rc: i32) -> Error

Create an error from a Paho C return code.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl !UnwindSafe for Error

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.

§

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