pub struct Message { /* private fields */ }
Expand description

A Message represents all the information passed in an MQTT PUBLISH packet. This is the primary data transfer mechanism.

Implementations

Creates a new message.

Arguments
  • topic The topic on which the message is published.
  • payload The binary payload of the message
  • qos The quality of service for message delivery (0, 1, or 2)

Creates a new message that will be retained by the broker. This creates a message with the ‘retained’ flag set.

Arguments
  • topic The topic on which the message is published.
  • payload The binary payload of the message
  • qos The quality of service for message delivery (0, 1, or 2)

Creates a new message from C language components.

Arguments
  • topic The topic on which the message is published.
  • msg The message struct from the C library

Gets the topic for the message.

Gets the payload of the message. This returns the payload as a slice.

Gets the payload of the message as a string.

This utilizes the “lossy” style of conversion from the std library. If the contents of the CStr are valid UTF-8 data, this function will return a Cow::Borrowed(&str) with the the corresponding &str slice. Otherwise, it will replace any invalid UTF-8 sequences with U+FFFD REPLACEMENT CHARACTER and return a Cow::Owned(String) with the result.

Returns the Quality of Service (QOS) for the message.

Gets the ‘retain’ flag for the message.

Gets the properties in the message

Trait Implementations

Create a clone of the message

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates a default, empty message

Formats the message for display

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Create WillOptions from a Message

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.