Struct WillOptions
#[non_exhaustive]pub struct WillOptions {
pub topic: TopicBuf,
pub payload: MqttBytesBuf,
pub qos: QoS,
pub retain: bool,
pub delay_interval: Option<u32>,
pub message_expiry: Option<u32>,
pub content_type: Option<MqttString>,
pub response_topic: Option<TopicBuf>,
pub correlation_data: Option<MqttBytesBuf>,
pub payload_format: Option<PayloadFormat>,
pub user_properties: Vec<(MqttString, MqttString)>,
}Expand description
Configuration for the MQTT will message (Last Will and Testament).
If set, the broker publishes this message when the client disconnects ungracefully.
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.topic: TopicBufTopic to publish the will message on.
payload: MqttBytesBufWill message payload.
qos: QoSQuality of Service for the will message.
retain: boolWhether the will message should be retained.
delay_interval: Option<u32>Will delay interval in seconds (property 0x18).
Delays publishing the will after disconnect.
message_expiry: Option<u32>Message expiry interval in seconds (property 0x02).
content_type: Option<MqttString>Content type (property 0x03).
response_topic: Option<TopicBuf>Response topic for request/response (property 0x08).
correlation_data: Option<MqttBytesBuf>Correlation data for request/response (property 0x09).
payload_format: Option<PayloadFormat>Whether the payload is UTF-8 encoded (property 0x01).
user_properties: Vec<(MqttString, MqttString)>User properties (property 0x26).
Implementations§
Source§impl WillOptions
impl WillOptions
Sourcepub const fn new(topic: TopicBuf, payload: MqttBytesBuf) -> WillOptions
pub const fn new(topic: TopicBuf, payload: MqttBytesBuf) -> WillOptions
Creates a will message with a topic and payload.
Sourcepub const fn qos(self, qos: QoS) -> WillOptions
pub const fn qos(self, qos: QoS) -> WillOptions
Sets the Quality of Service for the will message.
Sourcepub const fn retain(self, retain: bool) -> WillOptions
pub const fn retain(self, retain: bool) -> WillOptions
Sets the retain flag for the will message.
Sourcepub const fn delay_interval(self, seconds: u32) -> WillOptions
pub const fn delay_interval(self, seconds: u32) -> WillOptions
Sets the will delay interval in seconds (property 0x18).
Sourcepub const fn message_expiry(self, seconds: u32) -> WillOptions
pub const fn message_expiry(self, seconds: u32) -> WillOptions
Sets the message expiry interval in seconds (property 0x02).
Sourcepub fn content_type(self, ct: MqttString) -> WillOptions
pub fn content_type(self, ct: MqttString) -> WillOptions
Sets the content type (property 0x03).
Sourcepub fn response_topic(self, topic: TopicBuf) -> WillOptions
pub fn response_topic(self, topic: TopicBuf) -> WillOptions
Sets the response topic (property 0x08).
Sourcepub fn correlation_data(self, data: MqttBytesBuf) -> WillOptions
pub fn correlation_data(self, data: MqttBytesBuf) -> WillOptions
Sets correlation data (property 0x09).
Sourcepub const fn payload_format(self, format: PayloadFormat) -> WillOptions
pub const fn payload_format(self, format: PayloadFormat) -> WillOptions
Sets the payload format indicator (property 0x01).
Sourcepub fn user_property(self, key: MqttString, value: MqttString) -> WillOptions
pub fn user_property(self, key: MqttString, value: MqttString) -> WillOptions
Adds a user property (property 0x26). May be called multiple times.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WillOptions
impl RefUnwindSafe for WillOptions
impl Send for WillOptions
impl Sync for WillOptions
impl Unpin for WillOptions
impl UnsafeUnpin for WillOptions
impl UnwindSafe for WillOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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