pub fn parse(input: &str) -> Result<Unit>Expand description
Convenience free function, equivalent to Unit::parse.
Parses a GNU units expression string and returns the resulting Unit.
This function exists so callers can write gnu_units::parse("km") without
importing Unit explicitly.
§Errors
Returns Err(UnitsError) for the same reasons as Unit::parse: a null
byte in input, or an expression the GNU units parser cannot recognise.
§Examples
let unit = gnu_units::parse("km")?;
println!("factor: {}", unit.factor());