fn parse(unit: &str) -> Result<UnitExpr, ParseError> {
        let tokens = tokenize(unit);
        let mut stream = shunting_yard(tokens)?;
        let ast = read_expr(&mut stream)?;
        if stream.is_empty() {
            Ok(ast)
        } else {
            let remaining = stream.iter().map(|t| t.as_str()).collect::<Vec<_>>().join(" ");
            return Err(ParseError::MalformedExpr(
                format!("remaining values after the end of the unit: {}", remaining),
            ));
        }
    }
/// Parse a string, and generate the corresponding unit expression
Parse a string, and generate the corresponding unit expression
Parse a string and generate the corresponding unit expression
fn parse(unit: &str) -> Result<UnitExpr, ParseError> {
        let tokens = tokenize(unit);
        let mut stream = shunting_yard(tokens)?;
        let ast = read_expr(&mut stream)?;
        if stream.is_empty() {
            Ok(ast)
        } else {
            let remaining = stream.iter().map(|t| t.as_str()).collect::<Vec<_>>().join(" ");
            return Err(ParseError::MalformedExpr(
                format!("remaining values after the end of the unit: {}", remaining),
            ));
        }
    }
fn parse ( unit : & str ) -> Result < UnitExpr , ParseError > { let tokens = tokenize ( unit ) ; let mut stream = shunting_yard ( tokens ) ? ; let ast = read_expr ( & mut stream ) ? ; if stream . is_empty ( ) { Ok ( ast ) } else { let remaining = stream . iter ( ) . map ( | t | t . as_str ( ) ) . collect :: < Vec < _ > > ( ) . join ( " " ) ; return Err ( ParseError :: MalformedExpr ( format ! ( " " remaining ) , ) ) ; } }
Parse a string, and generate the corresponding unit expression
Parse a string and generate the corresponding unit expression
unit
&str