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>

source

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.
source

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 [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.
source

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.
source

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.
source

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.

source

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.
source

pub fn autodowngrade_qos(self) -> Self

Specify if publication [QoS] should be automatically downgraded to the maximum supported by the server if they exceed the server [QoS] maximum.

source

pub fn will(self, will: Will<'_>) -> Result<Self, ProtocolError>

Specify the Will message to be sent if the client disconnects.

Args
  • will - The will to use.

Trait Implementations§

source§

impl<'a, Broker: Debug + Broker> Debug for ConfigBuilder<'a, Broker>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, Broker> RefUnwindSafe for ConfigBuilder<'a, Broker>
where Broker: RefUnwindSafe,

§

impl<'a, Broker> Send for ConfigBuilder<'a, Broker>
where Broker: Send,

§

impl<'a, Broker> Sync for ConfigBuilder<'a, Broker>
where Broker: Sync,

§

impl<'a, Broker> Unpin for ConfigBuilder<'a, Broker>
where Broker: Unpin,

§

impl<'a, Broker> !UnwindSafe for ConfigBuilder<'a, Broker>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.