rust_mqtt/client/options/
disconnect.rs1use crate::config::SessionExpiryInterval;
2
3#[derive(Debug, Clone, Copy)]
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6pub struct Options {
7 pub publish_will: bool,
9
10 pub session_expiry_interval: Option<SessionExpiryInterval>,
14}
15
16impl Default for Options {
17 fn default() -> Self {
18 Self::new()
19 }
20}
21
22impl Options {
23 #[must_use]
25 pub const fn new() -> Self {
26 Self {
27 publish_will: false,
28 session_expiry_interval: None,
29 }
30 }
31
32 #[must_use]
34 pub const fn publish_will(mut self) -> Self {
35 self.publish_will = true;
36 self
37 }
38 #[must_use]
40 pub const fn session_expiry_interval(mut self, interval: SessionExpiryInterval) -> Self {
41 self.session_expiry_interval = Some(interval);
42 self
43 }
44}