pub struct MqttConnectionSettingsBuilder { /* private fields */ }
Expand description
Builder for MqttConnectionSettings
.
Implementations§
Source§impl MqttConnectionSettingsBuilder
impl MqttConnectionSettingsBuilder
Sourcepub fn hostname<VALUE: Into<String>>(self, value: VALUE) -> Self
pub fn hostname<VALUE: Into<String>>(self, value: VALUE) -> Self
FQDN of the host to connect to
Sourcepub fn tcp_port<VALUE: Into<u16>>(self, value: VALUE) -> Self
pub fn tcp_port<VALUE: Into<u16>>(self, value: VALUE) -> Self
TCP port to connect to the host on
Sourcepub fn keep_alive<VALUE: Into<Duration>>(self, value: VALUE) -> Self
pub fn keep_alive<VALUE: Into<Duration>>(self, value: VALUE) -> Self
Max time between communications
Sourcepub fn receive_max<VALUE: Into<u16>>(self, value: VALUE) -> Self
pub fn receive_max<VALUE: Into<u16>>(self, value: VALUE) -> Self
Max number of in-flight Quality of Service 1 and 2 messages
Sourcepub fn receive_packet_size_max<VALUE: Into<Option<u32>>>(
self,
value: VALUE,
) -> Self
pub fn receive_packet_size_max<VALUE: Into<Option<u32>>>( self, value: VALUE, ) -> Self
Max size of a received packet
Sourcepub fn session_expiry<VALUE: Into<Duration>>(self, value: VALUE) -> Self
pub fn session_expiry<VALUE: Into<Duration>>(self, value: VALUE) -> Self
Session Expiry Interval
Sourcepub fn connection_timeout<VALUE: Into<Duration>>(self, value: VALUE) -> Self
pub fn connection_timeout<VALUE: Into<Duration>>(self, value: VALUE) -> Self
Connection timeout
Sourcepub fn clean_start<VALUE: Into<bool>>(self, value: VALUE) -> Self
pub fn clean_start<VALUE: Into<bool>>(self, value: VALUE) -> Self
Clean start
Sourcepub fn password_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
pub fn password_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
Path to a file containing the MQTT password
Sourcepub fn ca_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
pub fn ca_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
Path to a PEM file used to validate server identity
Sourcepub fn cert_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
pub fn cert_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
Path to PEM file used to establish X509 client authentication
Sourcepub fn key_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
pub fn key_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
Path to a file containing a key used to establish X509 client authentication
Sourcepub fn key_password_file<VALUE: Into<Option<String>>>(
self,
value: VALUE,
) -> Self
pub fn key_password_file<VALUE: Into<Option<String>>>( self, value: VALUE, ) -> Self
Path to a file containing the password used to decrypt the Key
Sourcepub fn sat_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
pub fn sat_file<VALUE: Into<Option<String>>>(self, value: VALUE) -> Self
Path to a SAT file to be used for SAT auth
Sourcepub fn build(
self,
) -> Result<MqttConnectionSettings, MqttConnectionSettingsBuilderError>
pub fn build( self, ) -> Result<MqttConnectionSettings, MqttConnectionSettingsBuilderError>
Source§impl MqttConnectionSettingsBuilder
impl MqttConnectionSettingsBuilder
Sourcepub fn from_environment() -> Result<Self, String>
pub fn from_environment() -> Result<Self, String>
Initialize the MqttConnectionSettingsBuilder
from environment variables.
Values that are not present in the environment will be set to defaults (including those that are not possible to be provided by the AIO environment variables).
Example
let connection_settings = MqttConnectionSettingsBuilder::from_environment().unwrap().build()?;
§Errors
Returns a String
describing the error if any of the environment variables contain invalid data.