pub struct Connect<Bytes> { /* private fields */ }
Expand description
An MQTT CONNECT
packet
Implementations§
Source§impl<Bytes> Connect<Bytes>
impl<Bytes> Connect<Bytes>
Sourcepub fn new<T>(
keep_alive_secs: u16,
clean_session: bool,
client_id: T,
) -> Result<Self, MemoryError>
pub fn new<T>( keep_alive_secs: u16, clean_session: bool, client_id: T, ) -> Result<Self, MemoryError>
Creates a new packet
Sourcepub fn with_will<T, M>(
self,
topic: T,
message: M,
qos: u8,
retain: bool,
) -> Result<Self, MemoryError>
pub fn with_will<T, M>( self, topic: T, message: M, qos: u8, retain: bool, ) -> Result<Self, MemoryError>
Configures a last-will topic and message
§QoS Levels
Valid QoS levels are:
0
: At most one delivery1
: At least one delivery2
: Exactly one delivery
Sourcepub fn with_username_password<U, P>(
self,
username: U,
password: P,
) -> Result<Self, MemoryError>
pub fn with_username_password<U, P>( self, username: U, password: P, ) -> Result<Self, MemoryError>
Configures a username and password
Sourcepub const fn keep_alive_secs(&self) -> u16
pub const fn keep_alive_secs(&self) -> u16
Gets the seconds to keep the connection alive
Sourcepub const fn clean_session(&self) -> bool
pub const fn clean_session(&self) -> bool
Gets the clean session bit which indicate if the client and server do not need to process the deletion of state atomically
Sourcepub fn client_id(&self) -> &[u8]
pub fn client_id(&self) -> &[u8]
Gets the client identifier
§Important
MQTT allows only the characters 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
, and the
identifier should not be longer than 23 bytes.
Sourcepub const fn will_retain(&self) -> bool
pub const fn will_retain(&self) -> bool
Gets the will-retain bit to indicate if the will message is to be Retained when it is published
Sourcepub const fn will_qos(&self) -> u8
pub const fn will_qos(&self) -> u8
Gets the QoS level to be used when publishing the will message
Sourcepub fn will_topic(&self) -> Option<&[u8]>
pub fn will_topic(&self) -> Option<&[u8]>
Gets the will topic
Sourcepub fn will_message(&self) -> Option<&[u8]>
pub fn will_message(&self) -> Option<&[u8]>
Gets the will message
Trait Implementations§
Source§impl<Bytes> IntoIterator for Connect<Bytes>
impl<Bytes> IntoIterator for Connect<Bytes>
Source§type IntoIter = Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Empty<u8>, Once<u8>>, Take<<[u8; 4] as IntoIterator>::IntoIter>>, <[u8; 6] as IntoIterator>::IntoIter>, Once<u8>>, Once<u8>>, <[u8; 2] as IntoIterator>::IntoIter>, Chain<<[u8; 2] as IntoIterator>::IntoIter, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>
type IntoIter = Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Chain<Empty<u8>, Once<u8>>, Take<<[u8; 4] as IntoIterator>::IntoIter>>, <[u8; 6] as IntoIterator>::IntoIter>, Once<u8>>, Once<u8>>, <[u8; 2] as IntoIterator>::IntoIter>, Chain<<[u8; 2] as IntoIterator>::IntoIter, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>, Chain<Take<<[u8; 2] as IntoIterator>::IntoIter>, <Bytes as IntoIterator>::IntoIter>>
Which kind of iterator are we turning this into?
Source§impl<Bytes> TryFromIterator for Connect<Bytes>
impl<Bytes> TryFromIterator for Connect<Bytes>
Source§fn try_from_iter<T>(iter: T) -> Result<Self, DecoderError>where
T: IntoIterator<Item = u8>,
fn try_from_iter<T>(iter: T) -> Result<Self, DecoderError>where
T: IntoIterator<Item = u8>,
Tries to build
Self
from the given byte iteratorimpl<Bytes: Eq> Eq for Connect<Bytes>
impl<Bytes> StructuralPartialEq for Connect<Bytes>
Auto Trait Implementations§
impl<Bytes> Freeze for Connect<Bytes>where
Bytes: Freeze,
impl<Bytes> RefUnwindSafe for Connect<Bytes>where
Bytes: RefUnwindSafe,
impl<Bytes> Send for Connect<Bytes>where
Bytes: Send,
impl<Bytes> Sync for Connect<Bytes>where
Bytes: Sync,
impl<Bytes> Unpin for Connect<Bytes>where
Bytes: Unpin,
impl<Bytes> UnwindSafe for Connect<Bytes>where
Bytes: UnwindSafe,
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