#[non_exhaustive]pub struct MessageMeta {
pub qos: QoS,
pub retain: bool,
pub dup: bool,
pub v5: Option<Mqtt5Meta>,
}Expand description
Protocol metadata attached to an incoming MQTT message.
Delivered alongside every message (as Arc<MessageMeta>, shared across all
subscribers of one publish). Read its fields; you never construct it in the
receive path — but MessageMeta::new is provided so you can build one in
your own handler tests.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.qos: QoSQoS of the delivered PUBLISH packet — NOT the subscription’s granted QoS. With overlapping filters on one client the broker sends a single packet at the highest matching granted QoS, so a QoS-0 subscriber can observe a higher value here.
retain: boolThe broker delivered this as a retained message.
dup: boolThe dup flag was set (a redelivery of a QoS > 0 packet).
v5: Option<Mqtt5Meta>MQTT 5 properties. Always None on MQTT 3.1.1 (the only wire protocol in
0.3); reserved so v5 support lands additively.
Implementations§
Source§impl MessageMeta
impl MessageMeta
Sourcepub fn new(qos: QoS, retain: bool, dup: bool) -> MessageMeta
pub fn new(qos: QoS, retain: bool, dup: bool) -> MessageMeta
Build metadata for an MQTT 3.1.1 message (v5 == None).
The library uses this on the receive path; it is public so downstream
code can construct a MessageMeta in tests (the type is
#[non_exhaustive], so a struct literal is not available off-crate).
Sourcepub fn with_v5(
qos: QoS,
retain: bool,
dup: bool,
v5: Option<Mqtt5Meta>,
) -> MessageMeta
pub fn with_v5( qos: QoS, retain: bool, dup: bool, v5: Option<Mqtt5Meta>, ) -> MessageMeta
Build metadata carrying optional MQTT 5 properties.
Additive companion to new (which is the v5 == None
shorthand); used on the receive path when the packet carried v5
properties, and available to downstream tests.
Trait Implementations§
Source§impl Clone for MessageMeta
impl Clone for MessageMeta
Source§fn clone(&self) -> MessageMeta
fn clone(&self) -> MessageMeta
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more