pub fn parse_duration(input: &str) -> Option<u128>Expand description
Parses a duration string into a number of milliseconds.
This function takes a string in the format 1d1h1m1s and parses it into
a number of milliseconds. The string can contain any number of digits,
followed by any combination of the letters s, m, h, and d to
represent seconds, minutes, hours, and days, respectively.
§Arguments
input- A string in the format1d1h1m1s1.
§Returns
A number of milliseconds, or None if the input string is invalid.
If the integer overflows, the function returns None.
§Examples
use soar_utils::time::parse_duration;
let duration = parse_duration("1d1h1m1s");
println!("Duration: {}", duration.unwrap());