easytime
Providing wrapper types for safely performing panic-free checked arithmetic on instants and durations.
This crate provides the following two data structures.
-
easytime::Instant
-- A wrapper type forstd::time::Instant
-
easytime::Duration
-- A wrapper type forstd::time::Duration
Usage
Add this to your Cargo.toml
:
[]
= "0.1"
The current version of easytime requires Rust 1.34 or later.
Examples
use ;
use Duration as StdDuration;
If you use std::time
directly, you need to write as follows:
use ;
Optional features
std
(enabled by default)- Enable to use
easytime::Instant
. - This requires Rust 1.34 or later.
- If disabled this feature, easytime can compile with Rust 1.33.
- Enable to use
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.