pub struct Will {
pub topic: String,
pub payload: Bytes,
pub qos: QoS,
pub retain: bool,
}Expand description
Represents the Last Will and Testament (LWT) feature in MQTT.
The Will struct includes the topic, payload, QoS level, and retain flag for the LWT message.
This message will be published by the broker if the client disconnects unexpectedly.
§Example
use mqute_codec::protocol::v4::Will;
use mqute_codec::protocol::QoS;
use bytes::Bytes;
let will = Will::new("topic", Bytes::from("message"), QoS::AtLeastOnce, true);
assert_eq!(will.topic, "topic");
assert_eq!(will.payload, Bytes::from("message"));
assert_eq!(will.qos, QoS::AtLeastOnce);
assert_eq!(will.retain, true);Fields§
§topic: StringThe topic to which the LWT message will be published.
payload: BytesThe payload of the LWT message.
qos: QoSThe QoS level for the LWT message.
retain: boolWhether the LWT message should be retained by the broker.
Implementations§
Trait Implementations§
impl Eq for Will
impl StructuralPartialEq for Will
Auto Trait Implementations§
impl !Freeze for Will
impl RefUnwindSafe for Will
impl Send for Will
impl Sync for Will
impl Unpin for Will
impl UnwindSafe for Will
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