pub struct MqttClient<'a, 'n, 'l, M: RawMutex, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize>where
NET: TcpConnect,
DNS: Dns,{ /* private fields */ }Expand description
The MQTT Client to publish messages, subscribe, unsubscribe and receive messages
Implementations§
Source§impl<'a, 'n, 'l, M: RawMutex, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>where
NET: TcpConnect,
DNS: Dns,
impl<'a, 'n, 'l, M: RawMutex, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>where
NET: TcpConnect,
DNS: Dns,
pub async fn on_auto_subscribes_done(&self)
Sourcepub async fn publish(
&self,
topic: &str,
payload: &[u8],
qos: QoS,
retain: bool,
) -> Result<(), MqttError>
pub async fn publish( &self, topic: &str, payload: &[u8], qos: QoS, retain: bool, ) -> Result<(), MqttError>
Publish a MQTT message with the given parameters
Waits until there is a successful publish result. The publish is successful after all acknolodgements
accordings to the selected QoS have bee exchanged
Sourcepub async fn subscribe(&self, topic: &str, qos: QoS) -> Result<(), MqttError>
pub async fn subscribe(&self, topic: &str, qos: QoS) -> Result<(), MqttError>
Subscribe to a topic
The method returns after the suback has bee received
Sourcepub async fn unsubscribe(&self, topic: &str) -> Result<(), MqttError>
pub async fn unsubscribe(&self, topic: &str) -> Result<(), MqttError>
unsubscribe from a topic
waits until the unsuback has bee received
Sourcepub fn disconnect(&self)
pub fn disconnect(&self)
send a disconnect packet to the broker
Sourcepub fn subscribe_received_publishes(
&self,
) -> Result<DynSubscriber<'_, ReceivedPublish<BUFFER, TOPIC>>, MqttError>
pub fn subscribe_received_publishes( &self, ) -> Result<DynSubscriber<'_, ReceivedPublish<BUFFER, TOPIC>>, MqttError>
Subscribe to received publishes
Trait Implementations§
Source§impl<'a, 'n, 'l, M: Clone + RawMutex, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> Clone for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
impl<'a, 'n, 'l, M: Clone + RawMutex, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> Clone for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
Source§fn clone(&self) -> MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
fn clone(&self) -> MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a, 'n, 'l, M, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> Freeze for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
impl<'a, 'n, 'l, M, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> !RefUnwindSafe for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
impl<'a, 'n, 'l, M, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> !Send for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
impl<'a, 'n, 'l, M, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> !Sync for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
impl<'a, 'n, 'l, M, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> Unpin for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
impl<'a, 'n, 'l, M, NET, DNS, const BUFFER: usize, const TOPIC: usize, const QUEUE: usize> !UnwindSafe for MqttClient<'a, 'n, 'l, M, NET, DNS, BUFFER, TOPIC, QUEUE>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more