parse_float

Function parse_float 

Source
pub fn parse_float(value: &str, field_name: &str) -> Result<f64>
Expand description

Parse string to float with context

ยงExample

assert_eq!(parse_float("3.14", "pi").unwrap(), 3.14);
assert_eq!(parse_float("42", "value").unwrap(), 42.0);
assert!(parse_float("abc", "value").is_err());