pub fn split_cmd_topic(&self) -> Result<SerialOrAll> {
        // this starts at cmd/{datalog}/..
        let parts: Vec<String> = self.topic.split('/').map(|x| x.to_string()).collect();

        // bail if the topic is too short to handle.
        // this *shouldn't* happen as our subscribe is for lxp/cmd/{datalog}/#
        if parts.len() < 2 {
            return Err(anyhow!("ignoring badly formed MQTT topic: {}", self.topic));
        }

        if parts[1] == "all" {
            return Ok(SerialOrAll::All);
        }

        let serial = Serial::from_str(&parts[1])?;
        Ok(SerialOrAll::Serial(serial))
    }
// given a cmd Message, return the datalog it is intended for.
//
// eg cmd/AB12345678/ac_charge => AB12345678
given a cmd Message, return the datalog it is intended for.
given a cmd Message return the datalog it is intended for .
pub fn split_cmd_topic(&self) -> Result<SerialOrAll> {
        // this starts at cmd/{datalog}/..
        let parts: Vec<String> = self.topic.split('/').map(|x| x.to_string()).collect();
        // bail if the topic is too short to handle.
        // this *shouldn't* happen as our subscribe is for lxp/cmd/{datalog}/#
        if parts.len() < 2 {
            return Err(anyhow!("ignoring badly formed MQTT topic: {}", self.topic));
        }
        if parts[1] == "all" {
            return Ok(SerialOrAll::All);
        }
        let serial = Serial::from_str(&parts[1])?;
        Ok(SerialOrAll::Serial(serial))
    }
pub fn split_cmd_topic ( & self ) -> Result < SerialOrAll > { // this starts at cmd/{datalog}/.. let parts : Vec < String > = self . topic . split ( '/' ) . map ( | x | x . to_string ( ) ) . collect ( ) ; // bail if the topic is too short to handle. // this *shouldn't* happen as our subscribe is for lxp/cmd/{datalog}/# if parts . len ( ) < 2 { return Err ( anyhow ! ( " " self topic ) ) ; } if parts [ 1 ] == " " { return Ok ( SerialOrAll :: All ) ; } let serial = Serial :: from_str ( & parts [ 1 ] ) ? ; Ok ( SerialOrAll :: Serial ( serial ) ) }
given a cmd Message, return the datalog it is intended for.
given a cmd Message return the datalog it is intended for .
&self
&self