Struct iot_device_bridge::mqtt_client::AsyncClient
source · [−]pub struct AsyncClient { /* private fields */ }Implementations
sourceimpl AsyncClient
impl AsyncClient
sourcepub async fn new(
settings: ConnectionSettings
) -> Result<(AsyncClient, (EventLoop, Sender<Incoming>)), IoTError>
pub async fn new(
settings: ConnectionSettings
) -> Result<(AsyncClient, (EventLoop, Sender<Incoming>)), IoTError>
Create new MQTT AsyncClient. Input: ConnectionSettings. Output: tuple
- first element: AsyncClient,
- second element: tuple
- eventloop
- incoming_event_broadcaster. This (eventloop, incoming_event_broadcaster) tuple should be used as an argument to the eventloop_monitor.
sourcepub async fn publish<S, V>(
&self,
topic: S,
qos: QoS,
payload: V
) -> Result<(), ClientError> where
S: Into<String>,
V: Into<Vec<u8>>,
pub async fn publish<S, V>(
&self,
topic: S,
qos: QoS,
payload: V
) -> Result<(), ClientError> where
S: Into<String>,
V: Into<Vec<u8>>,
Publish to topic (no retaining of messages).
sourcepub async fn subscribe<S: Into<String>>(
&self,
topic: S,
qos: QoS
) -> Result<(), ClientError>
pub async fn subscribe<S: Into<String>>(
&self,
topic: S,
qos: QoS
) -> Result<(), ClientError>
Subscribe to a topic.
sourcepub async fn unsubscribe<S: Into<String>>(
&self,
topic: S
) -> Result<(), ClientError>
pub async fn unsubscribe<S: Into<String>>(
&self,
topic: S
) -> Result<(), ClientError>
Unsubscribe from a topic.
sourcepub async fn get_receiver(&self) -> Receiver<Incoming>
pub async fn get_receiver(&self) -> Receiver<Incoming>
Get a broadcast channel receiver of the incoming messages. Intended to read the incoming messages from IoT Core.
sourcepub async fn get_client(self) -> RumqttcAsyncClient
pub async fn get_client(self) -> RumqttcAsyncClient
Get the Rumqttc AsyncClient.
sourcepub fn get_eventloop_handle(&self) -> MqttSender<Request>
pub fn get_eventloop_handle(&self) -> MqttSender<Request>
Get an eventloop handle.
sourcepub async fn cancel(&self) -> Result<(), ClientError>
pub async fn cancel(&self) -> Result<(), ClientError>
Stops the eventloop.
sourcepub async fn disconnect(&self) -> Result<(), ClientError>
pub async fn disconnect(&self) -> Result<(), ClientError>
Sends MQTT disconnect to the eventloop.
Auto Trait Implementations
impl !RefUnwindSafe for AsyncClient
impl Send for AsyncClient
impl Sync for AsyncClient
impl Unpin for AsyncClient
impl !UnwindSafe for AsyncClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more