fn parse_name(&self, name: &str) -> Result<Vec<String>> {
        let mut result = Vec::new();

        let re = Regex::new(r"(\D*)(\d+)\s*\.\.\s*(\D*)(\d+)").unwrap();
        if re.is_match(name) {
            let caps = re
                .captures(name)
                .ok_or_else(|| QedaError::InvalidPinName(name.to_string()))?;
            ensure!(
                caps[1].eq(&caps[3]),
                QedaError::InvalidPinRangeNameBase(
                    name.to_string(),
                    caps[1].to_string(),
                    caps[3].to_string()
                )
            );
            let begin = caps[2].parse::<usize>()?;
            let end = caps[4].parse::<usize>()?;
            ensure!(begin < end, QedaError::InvalidPinName(name.to_string()));
            for i in begin..=end {
                ensure!(begin < end, QedaError::InvalidPinName(name.to_string()));
                result.push(format!("{}{}", &caps[1], i));
            }
        } else {
            result.push(name.to_string());
        }

        Ok(result)
    }
// Parse pin name(s) from string
Parse pin name(s) from string
Parse pin name ( s ) from string
fn parse_name(&self, name: &str) -> Result<Vec<String>> {
        let mut result = Vec::new();
        let re = Regex::new(r"(\D*)(\d+)\s*\.\.\s*(\D*)(\d+)").unwrap();
        if re.is_match(name) {
            let caps = re
                .captures(name)
                .ok_or_else(|| QedaError::InvalidPinName(name.to_string()))?;
            ensure!(
                caps[1].eq(&caps[3]),
                QedaError::InvalidPinRangeNameBase(
                    name.to_string(),
                    caps[1].to_string(),
                    caps[3].to_string()
                )
            );
            let begin = caps[2].parse::<usize>()?;
            let end = caps[4].parse::<usize>()?;
            ensure!(begin < end, QedaError::InvalidPinName(name.to_string()));
            for i in begin..=end {
                ensure!(begin < end, QedaError::InvalidPinName(name.to_string()));
                result.push(format!("{}{}", &caps[1], i));
            }
        } else {
            result.push(name.to_string());
        }
        Ok(result)
    }
fn parse_name ( & self , name : & str ) -> Result < Vec < String > > { let mut result = Vec :: new ( ) ; let re = Regex :: new ( r"(\D*)(\d+)\s*\.\.\s*(\D*)(\d+)" ) . unwrap ( ) ; if re . is_match ( name ) { let caps = re . captures ( name ) . ok_or_else ( | | QedaError :: InvalidPinName ( name . to_string ( ) ) ) ? ; ensure ! ( caps [ 1 ] eq ( caps [ 3 ] ) QedaError InvalidPinRangeNameBase ( name to_string ( ) caps [ 1 ] to_string ( ) caps [ 3 ] to_string ( ) ) ) ; let begin = caps [ 2 ] . parse :: < usize > ( ) ? ; let end = caps [ 4 ] . parse :: < usize > ( ) ? ; ensure ! ( begin end QedaError InvalidPinName ( name to_string ( ) ) ) ; for i in begin ..= end { ensure ! ( begin end QedaError InvalidPinName ( name to_string ( ) ) ) ; result . push ( format ! ( " " caps [ 1 ] i ) ) ; } } else { result . push ( name . to_string ( ) ) ; } Ok ( result ) }
Parse pin name(s) from string
Parse pin name ( s ) from string
&self
name
&str
&self
name
&str