pub struct DisconnectPacket {
pub reason_code: ReasonCode,
pub properties: Properties,
}Expand description
MQTT DISCONNECT packet
Fields§
§reason_code: ReasonCodeDisconnect reason code
properties: PropertiesDISCONNECT properties (v5.0 only)
Implementations§
Source§impl DisconnectPacket
impl DisconnectPacket
Sourcepub fn new(reason_code: ReasonCode) -> Self
pub fn new(reason_code: ReasonCode) -> Self
Creates a new DISCONNECT packet
Sourcepub fn with_session_expiry_interval(self, seconds: u32) -> Self
pub fn with_session_expiry_interval(self, seconds: u32) -> Self
Sets the session expiry interval
Sourcepub fn with_reason_string(self, reason: String) -> Self
pub fn with_reason_string(self, reason: String) -> Self
Sets the reason string
Sourcepub fn with_server_reference(self, reference: String) -> Self
pub fn with_server_reference(self, reference: String) -> Self
Sets the server reference for redirect
Sourcepub fn with_user_property(self, key: String, value: String) -> Self
pub fn with_user_property(self, key: String, value: String) -> Self
Adds a user property
Trait Implementations§
Source§impl Clone for DisconnectPacket
impl Clone for DisconnectPacket
Source§fn clone(&self) -> DisconnectPacket
fn clone(&self) -> DisconnectPacket
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DisconnectPacket
impl Debug for DisconnectPacket
Source§impl MqttPacket for DisconnectPacket
impl MqttPacket for DisconnectPacket
Source§fn packet_type(&self) -> PacketType
fn packet_type(&self) -> PacketType
Returns the packet type
Source§fn encode_body<B: BufMut>(&self, buf: &mut B) -> Result<()>
fn encode_body<B: BufMut>(&self, buf: &mut B) -> Result<()>
Encodes the packet body (without fixed header) Read more
Source§fn decode_body<B: Buf>(buf: &mut B, _fixed_header: &FixedHeader) -> Result<Self>
fn decode_body<B: Buf>(buf: &mut B, _fixed_header: &FixedHeader) -> Result<Self>
Decodes the packet body (without fixed header) Read more
Auto Trait Implementations§
impl Freeze for DisconnectPacket
impl RefUnwindSafe for DisconnectPacket
impl Send for DisconnectPacket
impl Sync for DisconnectPacket
impl Unpin for DisconnectPacket
impl UnwindSafe for DisconnectPacket
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