fundu 2.0.1

Configurable, precise and fast rust string parser to a Duration
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright (c) 2023 Joining7943 <joining@posteo.de>
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT

use fundu::{Duration, DurationParser, TimeUnit};

fn main() {
    let input = "100y";
    let duration = DurationParser::with_time_units(&[TimeUnit::Year])
        .parse(input)
        .unwrap();

    assert_eq!(duration, Duration::positive(3_155_760_000, 0))
}