Skip to main content

parse_duration

Function parse_duration 

Source
pub fn parse_duration(s: &str) -> Result<Duration, UnitError>
Expand description

Parses a duration: one or more <number><unit> parts with units ms, s, m, h, d, each unit at most once and from largest to smallest (1h30m, not 30m1h).

ยงErrors

Returns UnitError::Duration for anything else, including an empty string and a number without a unit.