Struct mqtt_async_client::client::Client[][src]

pub struct Client { /* fields omitted */ }

An MQTT client.

Start building an instance by calling Client::builder() to get a ClientBuilder, using the fluent builder pattern on ClientBuilder, then calling ClientBuilder::build(). For example:

let client =
    Client::builder()
       .set_host("example.com".to_owned())
       .build();

Client is expected to be Send (passable between threads), but not Sync (usable by multiple threads at the same time).

Implementations

impl Client[src]

pub fn builder() -> ClientBuilder[src]

Start a fluent builder interface to construct a Client.

pub async fn connect(&mut self) -> Result<()>[src]

Open a connection to the configured MQTT broker.

pub async fn publish(&self, p: &Publish) -> Result<()>[src]

Publish some data on a topic.

Note that this method takes &self. This means a caller can create several publish futures to publish several payloads of data simultaneously without waiting for responses.

pub async fn subscribe(&mut self, s: Subscribe) -> Result<SubscribeResult>[src]

Subscribe to some topics.read_subscriptions will return data for them.

pub async fn unsubscribe(&mut self, u: Unsubscribe) -> Result<()>[src]

Unsubscribe from some topics. read_subscriptions will no longer return data for them.

pub async fn read_subscriptions(&mut self) -> Result<ReadResult>[src]

Wait for the next Publish packet for one of this Client's subscriptions.

pub async fn disconnect(&mut self) -> Result<()>[src]

Gracefully close the connection to the server.

Trait Implementations

impl Debug for Client[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.