Struct minimq::config::ConfigBuilder
source · pub struct ConfigBuilder<'a, Broker: Broker> { /* private fields */ }
Expand description
Configuration specifying the operational state of the MQTT client.
Implementations§
source§impl<'a, Broker: Broker> ConfigBuilder<'a, Broker>
impl<'a, Broker: Broker> ConfigBuilder<'a, Broker>
sourcepub fn new(broker: Broker, buffer: &'a mut [u8]) -> Self
pub fn new(broker: Broker, buffer: &'a mut [u8]) -> Self
Construct configuration for the MQTT client.
§Args
buffer
- Memory used by the MQTT client. This memory is used for the will, the message receive buffer, the transmission buffer, and the client session state.
sourcepub fn session_state(self, config: BufferConfig) -> Self
pub fn session_state(self, config: BufferConfig) -> Self
Specify a specific configuration for the session state buffer.
§Note
The session state buffer is used for publications greater than crate::QoS::AtMostOnce. If these messages are unused, you can specify [BufferConfig::Exactly(0)].
§Args
config
- The configuration for the size of the session state buffer.
sourcepub fn rx_buffer(self, config: BufferConfig) -> Self
pub fn rx_buffer(self, config: BufferConfig) -> Self
Specify a specific configuration for the message receive buffer.
§Args
config
- The configuration for the size of the receive buffer.
sourcepub fn tx_buffer(self, config: BufferConfig) -> Self
pub fn tx_buffer(self, config: BufferConfig) -> Self
Specify a specific configuration for the message transmit buffer.
§Args
config
- The configuration for the size of the message transmit buffer.
sourcepub fn client_id(self, id: &str) -> Result<Self, ProtocolError>
pub fn client_id(self, id: &str) -> Result<Self, ProtocolError>
Specify a known client ID to use. If not assigned, the broker will auto assign an ID.
sourcepub fn keepalive_interval(self, seconds: u16) -> Self
pub fn keepalive_interval(self, seconds: u16) -> Self
Configure the MQTT keep-alive interval.
§Note
The broker may override the requested keep-alive interval. Any value requested by the broker will be used instead.
§Args
interval
- The keep-alive interval in seconds. A ping will be transmitted if no other messages are sent within 50% of the keep-alive interval.
sourcepub fn autodowngrade_qos(self) -> Self
pub fn autodowngrade_qos(self) -> Self
Specify if publication crate::QoS should be automatically downgraded to the maximum supported by the server if they exceed the server crate::QoS maximum.