Struct paho_mqtt::message::Message
[−]
[src]
pub struct Message { pub cmsg: MQTTAsync_message, pub topic: CString, // some fields omitted }
A Message
represents all the information passed in an MQTT PUBLISH
packet.
This is the primary data transfer mechanism.
Fields
cmsg: MQTTAsync_message
topic: CString
Methods
impl Message
[src]
fn new<V>(topic: &str, payload: V, qos: i32) -> Message where
V: Into<Vec<u8>>,
V: Into<Vec<u8>>,
Creates a new message.
Arguments
topic
The topic on which the message is published.payload
The binary payload of the messageqos
The quality of service for message delivery (0, 1, or 2)
fn new_retained<V>(topic: &str, payload: V, qos: i32) -> Message where
V: Into<Vec<u8>>,
V: Into<Vec<u8>>,
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 messageqos
The quality of service for message delivery (0, 1, or 2)
unsafe fn from_c_parts(topic: CString, cmsg: &MQTTAsync_message) -> Message
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
fn get_topic(&self) -> Result<String, IntoStringError>
Gets the topic for the message. Note that this copies the topic.
fn get_payload(&self) -> &Vec<u8>
Gets the payload of the message. This returns the payload as a binary vector.
fn get_payload_str(&self) -> Result<String, FromUtf8Error>
Gets the payload of the message as a string. Note that this clones the payload.
fn get_qos(&self) -> i32
Returns the Quality of Service (QOS) for the message.
fn get_retained(&self) -> bool
Gets the 'retained' flag for the message.
Trait Implementations
impl Debug for Message
[src]
impl Default for Message
[src]
impl Clone for Message
[src]
fn clone(&self) -> Message
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more