pub async fn disconnect(self) -> Result<()> {
        if let Some(client) = &self.client.mqtt_client {
            client.disconnect().await?;
            self.client.mqtt_client = None;

            let mqtt_topic_handlers = &self.client.mqtt_topic_handlers;
            let mut mqtt_topic_handlers = mqtt_topic_handlers.write().await;
            mqtt_topic_handlers.clear()
        }

        Ok(())
    }
/// Disconnects the broker.
/// This will clear the stored topic handlers and close the MQTT connection.
Disconnects the broker.
This will clear the stored topic handlers and close the MQTT connection.
Disconnects the broker . This will clear the stored topic handlers and close the MQTT connection .
pub async fn disconnect(self) -> Result<()> {
        if let Some(client) = &self.client.mqtt_client {
            client.disconnect().await?;
            self.client.mqtt_client = None;
            let mqtt_topic_handlers = &self.client.mqtt_topic_handlers;
            let mut mqtt_topic_handlers = mqtt_topic_handlers.write().await;
            mqtt_topic_handlers.clear()
        }
        Ok(())
    }
pub async fn disconnect ( self ) -> Result < ( ) > { if let Some ( client ) = & self . client . mqtt_client { client . disconnect ( ) . await ? ; self . client . mqtt_client = None ; let mqtt_topic_handlers = & self . client . mqtt_topic_handlers ; let mut mqtt_topic_handlers = mqtt_topic_handlers . write ( ) . await ; mqtt_topic_handlers . clear ( ) } Ok ( ( ) ) }
Disconnects the broker.
Disconnects the broker .
self
self