pub async fn unsubscribe(&mut self, topics: &Vec<String>) -> Result<&Self, MqttError> {
        info!("--Unsubscribe--");
        let mut raw_buf: [u8; 1024] = [0; 1024];

        self.send_packet(|pid| {
            // Encode an MQTT Connect packet.
            let pkt = mqttrs::Unsubscribe {
                pid,
                topics: topics.to_vec(),
            }
            .into();

            let length = mqttrs::encode_slice(&pkt, &mut raw_buf)?;
            let buf = BytesMut::from(&raw_buf[..length]);

            let pid = pid.get();

            let msg = MqttMsg::new((pid as u16).into(), buf);
            let fut = msg.get_packet_future();
            let channel_packet = ChannelPacket::Generic(msg);

            Ok((channel_packet, fut, pid))
        })
        .await?;
        Ok(self)
    }
/// Unsubscribe client from topics
///
/// By unsubscribing from given topic, the client stops receiving the messages destinated to it.
///
Unsubscribe client from topics
By unsubscribing from given topic, the client stops receiving the messages destinated to it.
Unsubscribe client from topics By unsubscribing from given topic the client stops receiving the messages destinated to it .
pub async fn unsubscribe(&mut self, topics: &Vec<String>) -> Result<&Self, MqttError> {
        info!("--Unsubscribe--");
        let mut raw_buf: [u8; 1024] = [0; 1024];
        self.send_packet(|pid| {
            // Encode an MQTT Connect packet.
            let pkt = mqttrs::Unsubscribe {
                pid,
                topics: topics.to_vec(),
            }
            .into();
            let length = mqttrs::encode_slice(&pkt, &mut raw_buf)?;
            let buf = BytesMut::from(&raw_buf[..length]);
            let pid = pid.get();
            let msg = MqttMsg::new((pid as u16).into(), buf);
            let fut = msg.get_packet_future();
            let channel_packet = ChannelPacket::Generic(msg);
            Ok((channel_packet, fut, pid))
        })
        .await?;
        Ok(self)
    }
pub async fn unsubscribe ( & mut self , topics : & Vec < String > ) -> Result < & Self , MqttError > { info ! ( " " ) ; let mut raw_buf : [ u8 ; 1024 ] = [ 0 ; 1024 ] ; self . send_packet ( | pid | { // Encode an MQTT Connect packet. let pkt = mqttrs :: Unsubscribe { pid , topics : topics . to_vec ( ) , } . into ( ) ; let length = mqttrs :: encode_slice ( & pkt , & mut raw_buf ) ? ; let buf = BytesMut :: from ( & raw_buf [ .. length ] ) ; let pid = pid . get ( ) ; let msg = MqttMsg :: new ( ( pid as u16 ) . into ( ) , buf ) ; let fut = msg . get_packet_future ( ) ; let channel_packet = ChannelPacket :: Generic ( msg ) ; Ok ( ( channel_packet , fut , pid ) ) } ) . await ? ; Ok ( self ) }
Unsubscribe client from topics
By unsubscribing from given topic, the client stops receiving the messages destinated to it.
Unsubscribe client from topics By unsubscribing from given topic the client stops receiving the messages destinated to it .
&mut self
topics
&Vec<String>
&mut self
topics
&Vec<String>