Skip to main content

parse_duration

Function parse_duration 

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

Parse "30s", "5m", "1h", "1d", "1y", or a bare integer (seconds). Bare unit strings like "m" (without a count) are interpreted as "1m" so rate-limit specs like "5/m" parse cleanly.