fn handle_incoming_publish<'b>(
        &mut self,
        publish: Publish<'b>,
    ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
        let qospid = (publish.qos, publish.pid);
        let boxed_publish = BOXED_PUBLISH::alloc().unwrap();
        let notification = Notification::Publish(boxed_publish.init(publish.try_into().unwrap()));

        let request = match qospid {
            (QoS::AtMostOnce, _) => None,
            (QoS::AtLeastOnce, Some(pid)) => Some(Packet::Puback(pid)),
            (QoS::ExactlyOnce, Some(pid)) => {
                self.incoming_pub.insert(pid.get()).map_err(|_| {
                    mqtt_log!(error, "Failed to insert incoming pub!");
                    StateError::InvalidState
                })?;

                Some(Packet::Pubrec(pid))
            }
            _ => return Err(StateError::InvalidHeader),
        };
        Ok((Some(notification), request))
    }
/// Results in a publish notification in all the QoS cases. Replys with an ack
/// in case of QoS1 and Replys rec in case of QoS while also storing the message
Results in a publish notification in all the QoS cases. Replys with an ack
in case of QoS1 and Replys rec in case of QoS while also storing the message
Results in a publish notification in all the QoS cases . Replys with an ack in case of QoS1 and Replys rec in case of QoS while also storing the message
fn handle_incoming_publish<'b>(
        &mut self,
        publish: Publish<'b>,
    ) -> Result<(Option<Notification>, Option<Packet<'static>>), StateError> {
        let qospid = (publish.qos, publish.pid);
        let boxed_publish = BOXED_PUBLISH::alloc().unwrap();
        let notification = Notification::Publish(boxed_publish.init(publish.try_into().unwrap()));
        let request = match qospid {
            (QoS::AtMostOnce, _) => None,
            (QoS::AtLeastOnce, Some(pid)) => Some(Packet::Puback(pid)),
            (QoS::ExactlyOnce, Some(pid)) => {
                self.incoming_pub.insert(pid.get()).map_err(|_| {
                    mqtt_log!(error, "Failed to insert incoming pub!");
                    StateError::InvalidState
                })?;
                Some(Packet::Pubrec(pid))
            }
            _ => return Err(StateError::InvalidHeader),
        };
        Ok((Some(notification), request))
    }
fn handle_incoming_publish < ' b > ( & mut self , publish : Publish < ' b > , ) -> Result < ( Option < Notification > , Option < Packet < ' static > > ) , StateError > { let qospid = ( publish . qos , publish . pid ) ; let boxed_publish = BOXED_PUBLISH :: alloc ( ) . unwrap ( ) ; let notification = Notification :: Publish ( boxed_publish . init ( publish . try_into ( ) . unwrap ( ) ) ) ; let request = match qospid { ( QoS :: AtMostOnce , _ ) => None , ( QoS :: AtLeastOnce , Some ( pid ) ) => Some ( Packet :: Puback ( pid ) ) , ( QoS :: ExactlyOnce , Some ( pid ) ) => { self . incoming_pub . insert ( pid . get ( ) ) . map_err ( | _ | { mqtt_log ! ( error " " ) ; StateError :: InvalidState } ) ? ; Some ( Packet :: Pubrec ( pid ) ) } _ => return Err ( StateError :: InvalidHeader ) , } ; Ok ( ( Some ( notification ) , request ) ) }
Results in a publish notification in all the QoS cases.
Results in a publish notification in all the QoS cases .
&mut self
publish
Publish<'b>
&mut self
publish
Publish<'b>