[][src]Struct mqtt_async_client::client::ClientBuilder

pub struct ClientBuilder { /* fields omitted */ }

A fluent builder interface to configure a Client.

Note that you must call .set_host() to configure a host to connect to before .build()

Methods

impl ClientBuilder[src]

pub fn build(&mut self) -> Result<Client>[src]

Build a new Client with this configuration.

pub fn set_host(&mut self, host: String) -> &mut Self[src]

Set host to connect to. This is a required parameter.

pub fn set_port(&mut self, port: u16) -> &mut Self[src]

Set TCP port to connect to.

The default value is 1883.

pub fn set_username(&mut self, username: Option<String>) -> &mut Self[src]

Set username to authenticate with.

The default value is no username.

pub fn set_password(&mut self, password: Option<Vec<u8>>) -> &mut Self[src]

Set password to authenticate with.

The default is no password.

pub fn set_keep_alive(&mut self, keep_alive: KeepAlive) -> &mut Self[src]

Set keep alive time.

This controls how often ping requests are sent when the connection is idle. See MQTT 3.1.1 specification section 3.1.2.10

The default value is 30 seconds.

pub fn set_tokio_runtime(&mut self, rt: TokioRuntime) -> &mut Self[src]

Set the tokio runtime to spawn background tasks onto.

The default is to use the default tokio runtime, i.e. tokio::spawn().

pub fn set_client_id(&mut self, client_id: Option<String>) -> &mut Self[src]

Set the ClientId to connect with.

pub fn set_packet_buffer_len(&mut self, packet_buffer_len: usize) -> &mut Self[src]

Set the inbound and outbound packet buffer length.

The default is 100.

pub fn set_max_packet_len(&mut self, max_packet_len: usize) -> &mut Self[src]

Set the maximum packet length.

The default is 64 * 1024 bytes.

pub fn set_operation_timeout(
    &mut self,
    operation_timeout: Duration
) -> &mut Self
[src]

Set the timeout for operations.

The default is 20 seconds.

pub fn set_tls_client_config(
    &mut self,
    tls_client_config: ClientConfig
) -> &mut Self
[src]

Set the TLS ClientConfig for the client-server connection.

Enables TLS. By default TLS is disabled.

pub fn set_automatic_connect(&mut self, automatic_connect: bool) -> &mut Self[src]

Set whether to automatically connect and reconnect.

The default is true.

pub fn set_connect_retry_delay(
    &mut self,
    connect_retry_delay: Duration
) -> &mut Self
[src]

Set the delay between connect retries.

The default is 30s.

Trait Implementations

impl Default for ClientBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.