[−][src]Struct mqtt_async_client::client::Client
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]
&'_ mut self,
s: Subscribe
) -> Result<SubscribeResult>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,