pub struct ConnectPacket {
pub protocol_version: u8,
pub clean_start: bool,
pub keep_alive: u16,
pub client_id: String,
pub username: Option<String>,
pub password: Option<Vec<u8>>,
pub will: Option<WillMessage>,
pub properties: Properties,
pub will_properties: Properties,
}Expand description
MQTT CONNECT packet
Fields§
§protocol_version: u8Protocol version (4 for v3.1.1, 5 for v5.0)
clean_start: boolClean start flag (Clean Session in v3.1.1)
keep_alive: u16Keep alive interval in seconds
client_id: StringClient identifier
username: Option<String>Username (optional)
password: Option<Vec<u8>>Password (optional)
will: Option<WillMessage>Will message (optional)
properties: PropertiesCONNECT properties (v5.0 only)
will_properties: PropertiesWill properties (v5.0 only)
Implementations§
Source§impl ConnectPacket
impl ConnectPacket
Sourcepub fn new(options: ConnectOptions) -> Self
pub fn new(options: ConnectOptions) -> Self
Creates a new CONNECT packet from options
Sourcepub fn new_v311(options: ConnectOptions) -> Self
pub fn new_v311(options: ConnectOptions) -> Self
Creates a v3.1.1 compatible CONNECT packet
Trait Implementations§
Source§impl Clone for ConnectPacket
impl Clone for ConnectPacket
Source§fn clone(&self) -> ConnectPacket
fn clone(&self) -> ConnectPacket
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 ConnectPacket
impl Debug for ConnectPacket
Source§impl MqttPacket for ConnectPacket
impl MqttPacket for ConnectPacket
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 ConnectPacket
impl RefUnwindSafe for ConnectPacket
impl Send for ConnectPacket
impl Sync for ConnectPacket
impl Unpin for ConnectPacket
impl UnwindSafe for ConnectPacket
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