pub struct ConnectOptions<'c> {
pub clean_start: bool,
pub keep_alive: KeepAlive,
pub session_expiry_interval: SessionExpiryInterval,
pub maximum_packet_size: MaximumPacketSize,
pub request_response_information: bool,
pub user_name: Option<MqttString<'c>>,
pub password: Option<MqttBinary<'c>>,
pub will: Option<WillOptions<'c>>,
}Expand description
Options for a connection.
Fields§
§clean_start: boolIf set to true, a new session is started. If set to false, an existing session is continued.
keep_alive: KeepAliveThe setting of the keep alive the client wishes. Can be set to a different value by the server.
session_expiry_interval: SessionExpiryIntervalThe setting of the session expiry interval the server wishes. Can be set to a different value by the server.
maximum_packet_size: MaximumPacketSizeThe maximum packet size that the client is willing to accept
request_response_information: boolWhen set to true, the broker may return response information used to construct response topics.
user_name: Option<MqttString<'c>>The user name the client wishes to authenticate with.
password: Option<MqttBinary<'c>>The password the client wishes to perform basic authentication with.
will: Option<WillOptions<'c>>The will configuration for the session of the connection.
Implementations§
Source§impl<'c> Options<'c>
impl<'c> Options<'c>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates new connect options with no clean start, infinite keep alive and session expiry immediately after disconnecting.
Sourcepub const fn clean_start(self) -> Self
pub const fn clean_start(self) -> Self
Sets the clean start flag to true.
Sourcepub const fn keep_alive(self, keep_alive: KeepAlive) -> Self
pub const fn keep_alive(self, keep_alive: KeepAlive) -> Self
Sets the desired keep alive of the connection.
Sourcepub const fn session_expiry_interval(
self,
interval: SessionExpiryInterval,
) -> Self
pub const fn session_expiry_interval( self, interval: SessionExpiryInterval, ) -> Self
Sets the desired session expiry interval of the connection.
Sourcepub const fn maximum_packet_size(
self,
maximum_packet_size: NonZero<u32>,
) -> Self
pub const fn maximum_packet_size( self, maximum_packet_size: NonZero<u32>, ) -> Self
Sets the maximum packet size as a limit in bytes. A value less than 2 does not make sense.
Sourcepub const fn request_response_information(self) -> Self
pub const fn request_response_information(self) -> Self
Sets the request response information property to true prompting the server to return a response information property to construct response topics.
Sourcepub fn user_name(self, user_name: MqttString<'c>) -> Self
pub fn user_name(self, user_name: MqttString<'c>) -> Self
Sets the user name.
Sourcepub fn password(self, password: MqttBinary<'c>) -> Self
pub fn password(self, password: MqttBinary<'c>) -> Self
Sets the password.
Sourcepub fn will(self, will: WillOptions<'c>) -> Self
pub fn will(self, will: WillOptions<'c>) -> Self
Sets the will.