pub struct MqttMessage {
pub topic: String,
pub payload: Vec<u8>,
pub qos: QoS,
pub retain: bool,
pub client_id: Option<String>,
pub timestamp: i64,
}Fields§
§topic: String§payload: Vec<u8>§qos: QoS§retain: bool§client_id: Option<String>§timestamp: i64Implementations§
Source§impl MqttMessage
impl MqttMessage
pub fn new(topic: impl Into<String>, payload: Vec<u8>) -> MqttMessage
pub fn with_qos(self, qos: QoS) -> MqttMessage
pub fn retain(self) -> MqttMessage
pub fn with_client(self, client_id: impl Into<String>) -> MqttMessage
pub fn text(&self) -> Option<&str>
pub fn json<T>(&self) -> Option<T>where
T: DeserializeOwned,
Source§impl MqttMessage
impl MqttMessage
pub fn text_message( topic: impl Into<String>, text: impl Into<String>, ) -> MqttMessage
pub fn json_message<T>(
topic: impl Into<String>,
data: &T,
) -> Result<MqttMessage, MqttError>where
T: Serialize,
Trait Implementations§
Source§impl Clone for MqttMessage
impl Clone for MqttMessage
Source§fn clone(&self) -> MqttMessage
fn clone(&self) -> MqttMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MqttMessage
impl RefUnwindSafe for MqttMessage
impl Send for MqttMessage
impl Sync for MqttMessage
impl Unpin for MqttMessage
impl UnsafeUnpin for MqttMessage
impl UnwindSafe for MqttMessage
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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