Skip to main content

parse_duration

Function parse_duration 

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

Parses a duration such as 250ms, 1s, 5m, or 1h.

A bare number is rejected on purpose: interval = 1 is ambiguous between one second and one millisecond, and ยง12 requires that invalid values point at the exact key rather than guess.