[][src]Struct paho_mqtt::create_options::CreateOptionsBuilder

pub struct CreateOptionsBuilder { /* fields omitted */ }

Builder to construct client creation options.

Examples

use paho_mqtt as mqtt;

let opts = mqtt::CreateOptionsBuilder::new()
                   .server_uri("tcp://localhost:1883")
                   .client_id("client1")
                   .finalize();

let cli = mqtt::AsyncClient::new(opts).unwrap();

Implementations

impl CreateOptionsBuilder[src]

pub fn new() -> Self[src]

Constructs a builder with default options.

pub fn server_uri<S>(self, server_uri: S) -> Self where
    S: Into<String>, 
[src]

Sets the the URI to the MQTT broker. Alternately, the application can specify multiple servers via the connect options.

Arguments

server_uri The URI string to specify the server in the form protocol://host:port, where the protocol can be tcp or ssl, and the host can be an IP address or domain name.

pub fn client_id<S>(self, client_id: S) -> Self where
    S: Into<String>, 
[src]

Sets the client identifier string that is sent to the server. The client ID is a unique name to identify the client to the server, which can be used if the client desires the server to hold state about the session. If the client requests a clean sesstion, this can be an empty string.

The broker is required to honor a client ID of up to 23 bytes, but could honor longer ones, depending on the broker.

Note that if this is an empty string, the clean session parameter must be set to true.

Arguments

client_id A UTF-8 string identifying the client to the server.

pub fn persistence<P>(self, persist: P) -> Self where
    P: Into<PersistenceType>, 
[src]

Sets the type of persistence used by the client. The default is for the library to automatically use file persistence, although this can be turned off by specify None for a more performant, though possibly less reliable system.

Arguments

persist The type of persistence to use.

pub fn user_persistence<T>(self, persistence: T) -> Self where
    T: ClientPersistence + Send + 'static, 
[src]

Sets a user-defined persistence store. This sets the persistence to use a custom one defined by the application. This can be anything that implements the ClientPersistence trait.

Arguments

persist An application-defined custom persistence store.

pub fn max_buffered_messages(self, n: i32) -> Self[src]

Sets the maximum number of messages that can be buffered for delivery when the client is off-line. The client has limited support for bufferering messages when the client is temporarily disconnected. This specifies the maximum number of messages that can be buffered.

Arguments

n The maximum number of messages that can be buffered. Setting this to zero disables off-line buffering.

pub fn mqtt_version(self, ver: u32) -> Self[src]

Sets the version of MQTT to use on the connect.

Arguments

ver The version of MQTT to use when connecting to the broker. * (0) try the latest version (3.1.1) and work backwards * (3) only try v3.1 * (4) only try v3.1.1 * (5) only try v5

pub fn allow_disconnected_send_at_anytime(self, allow: bool) -> Self[src]

Allow sending of messages while disconnected before a first successful connect.

pub fn delete_oldest_messages(self, delete_oldest: bool) -> Self[src]

When the maximum number of buffered messages is reached, delete the oldest rather than the newest.

pub fn restore_messages(self, restore: bool) -> Self[src]

If set, messages from persistence are restored on create. Defaults to true.

pub fn persist_qos0(self, persist: bool) -> Self[src]

If set, QoS0 publish commands are persisted. Defaults to true.

pub fn user_data(self, data: UserData) -> Self[src]

Sets the user-defined data structure for the client.

pub fn finalize(self) -> CreateOptions[src]

Constructs a set of create options from the builder information.

pub fn create_client(self) -> Result<AsyncClient>[src]

Finalize the builder and create an asynchronous client.

Trait Implementations

impl Default for CreateOptionsBuilder[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.