pub struct DisconnectOptionsBuilder { /* private fields */ }
Expand description
Builder to create the options for disconnecting from an MQTT server.
Implementations
sourceimpl DisconnectOptionsBuilder
impl DisconnectOptionsBuilder
sourcepub fn timeout(&mut self, timeout: Duration) -> &mut Self
pub fn timeout(&mut self, timeout: Duration) -> &mut Self
Sets the time interval to allow the disconnect to complete. This specifies the time to allow in-flight messages to complete.
Arguments
timeout
The time interval to allow the disconnect to
complete. This has a resolution of seconds.
sourcepub fn reason_code(&mut self, reason_code: ReasonCode) -> &mut Self
pub fn reason_code(&mut self, reason_code: ReasonCode) -> &mut Self
Set the reason for the disconnect.
The valid disconnect reasons are listed here in the spec: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901208
sourcepub fn publish_will_message(&mut self) -> &mut Self
pub fn publish_will_message(&mut self) -> &mut Self
Tell the server to publish the will message on this disconnect.
This sets the reason code in the options to 0x04: “Disconnect with Will Message”
sourcepub fn properties(&mut self, props: Properties) -> &mut Self
pub fn properties(&mut self, props: Properties) -> &mut Self
Sets the collection of properties for the disconnect.
Arguments
props
The collection of properties to include with the
disconnect message.
sourcepub fn finalize(&self) -> DisconnectOptions
pub fn finalize(&self) -> DisconnectOptions
Finalize the builder to create the disconnect options.
Trait Implementations
sourceimpl Debug for DisconnectOptionsBuilder
impl Debug for DisconnectOptionsBuilder
sourceimpl Default for DisconnectOptionsBuilder
impl Default for DisconnectOptionsBuilder
sourcefn default() -> DisconnectOptionsBuilder
fn default() -> DisconnectOptionsBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for DisconnectOptionsBuilder
impl !Send for DisconnectOptionsBuilder
impl !Sync for DisconnectOptionsBuilder
impl Unpin for DisconnectOptionsBuilder
impl UnwindSafe for DisconnectOptionsBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more