Skip to main content

parse

Function parse 

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

Parses a Duration from a string with a supported unit.

Bare integers are treated as milliseconds. Supported suffixes are ns, us, µs, ms, s, m, h, and d.

§Parameters

  • text: Duration text to parse.

§Returns

The parsed Duration.

§Errors

Returns a message describing invalid syntax, unsupported units, or overflow.