Function parse_duration

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

Parse a humantime string into a Duration.

Accepts forms like 30s, 5m, 2h, 1d, or just a number of seconds. Returns an error if the string is malformed.