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

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();

Methods

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.

Auto Trait Implementations

impl !RefUnwindSafe for Client

impl Send for Client

impl !Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

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.