pub fn parse_duration(i: &str) -> IResult<&str, Duration>Expand description
Parses a duration string into a Duration. Duration strings support the
following grammar:
DurationString -> Sign? Number Unit String? Sign -> ‘-’ Number -> Digit+ (‘.’ Digit+)? Digit -> ‘0’ | ‘1’ | ‘2’ | ‘3’ | ‘4’ | ‘5’ | ‘6’ | ‘7’ | ‘8’ | ‘9’ Unit -> ‘h’ | ‘m’ | ‘s’ | ‘ms’ | ‘us’ | ‘ns’ String -> DurationString
§Examples
1hparses as 1 hour1.5hparses as 1 hour and 30 minutes1h30mparses as 1 hour and 30 minutes1h30m1sparses as 1 hour, 30 minutes, and 1 second1msparses as 1 millisecond1.5msparses as 1 millisecond and 500 microseconds1nsparses as 1 nanosecond1.5nsparses as 1 nanosecond (sub-nanosecond durations not supported)