Struct Connect
pub struct Connect<'a> {
pub clean_start: bool,
pub keep_alive: Option<NonZeroU16>,
pub properties: &'a ConnectProperties,
pub client_id: &'a MqttStr,
pub will: Option<Will<'a>>,
pub username: Option<&'a MqttStr>,
pub password: Option<&'a MqttBytes>,
}Expand description
CONNECT packet sent by the client to initiate a session.
Fields§
§clean_start: boolWhether to start a new session, discarding any existing one.
keep_alive: Option<NonZeroU16>Keep-alive interval in seconds.
properties: &'a ConnectPropertiesCONNECT properties.
client_id: &'a MqttStrClient identifier.
will: Option<Will<'a>>Will message, if included.
username: Option<&'a MqttStr>Username for authentication.
password: Option<&'a MqttBytes>Password for authentication.
Implementations§
§impl<'a> Connect<'a>
impl<'a> Connect<'a>
const fn flags(&self) -> ConnectFlags
pub const fn encoded_len(&self) -> usize
pub const fn encoded_len(&self) -> usize
Returns the encoded size of the variable header + payload in bytes.
pub const fn encode(&self, w: &mut Writer<'_>) -> Result<(), EncodeError>
pub const fn encode(&self, w: &mut Writer<'_>) -> Result<(), EncodeError>
Encodes the CONNECT variable header + payload into the writer.
§Errors
Returns EncodeError::InsufficientSpace if the writer does not have
enough capacity.
pub const fn decode(r: &mut Reader<'a>) -> Result<Self, DecodeError>
pub const fn decode(r: &mut Reader<'a>) -> Result<Self, DecodeError>
Decodes a CONNECT packet from the reader.
§Errors
Returns DecodeError if the data is malformed, the protocol name or
version is invalid, or properties contain disallowed IDs.
Trait Implementations§
impl<'a> Eq for Connect<'a>
impl<'a> StructuralPartialEq for Connect<'a>
Auto Trait Implementations§
impl<'a> Freeze for Connect<'a>
impl<'a> RefUnwindSafe for Connect<'a>
impl<'a> Send for Connect<'a>
impl<'a> Sync for Connect<'a>
impl<'a> Unpin for Connect<'a>
impl<'a> UnwindSafe for Connect<'a>
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