pub fn parse(input: &str) -> Result<f64, ParseError>Expand description
Parses a human-readable time string into milliseconds.
Accepts strings like "100ms", "1s", "2.5h", "1 day", etc.
Whitespace between the number and unit is allowed.
§Examples
use ms_convert::parse;
assert_eq!(parse("1s").unwrap(), 1_000.0);
assert_eq!(parse("1.5h").unwrap(), 5_400_000.0);
assert_eq!(parse("2 days").unwrap(), 172_800_000.0);
assert_eq!(parse("-100ms").unwrap(), -100.0);§Errors
Returns ParseError if the input is empty, too long, has an invalid format,
or contains an unknown unit.