Skip to main content

evaluate

Function evaluate 

Source
pub fn evaluate(text: &str, unit: &str) -> Result<f64, String>
Expand description

Evaluate what a user typed into a number field whose unit is unit (“” for none): + - * /, parentheses, and unit names, which multiply the value before them into the field’s unit, so 1/2 in in a millimetre field is 12.7 and 2 in + 5 is 55.8. This is the gallery’s stand-in: the form wiring (rollout step 3) hands the text to the engine’s expression evaluator.