duration
Parsing and formatting of durations as short human-readable strings (1h30m).
The strings use the units ms, s, m, h, d and w. Values are std::time::Duration.
Install
Section titled “Install”Cargo feature duration (enabled by default). To compile only this module:
or in Cargo.toml:
Import path: helpers4::duration.
| Item | What it does |
|---|---|
format | Formats duration as a short human-readable string such as "1h 30m 5s". |
parse | Parses a human-written duration such as "1h30m", "2d" or "500ms". |
Error types
Section titled “Error types”Documented on the page of the helper that returns them.
| Type | Returned by |
|---|---|
ParseDurationError | parse |
