Round numbers and durations to a given factor
This provides an implementation of rounding for various values, including the
native number types and core::time::Duration (or
std::time::Duration).
This crate is does not need std or alloc (it’s always in no_std mode). No
features need to be enabled or disabled.
use Roundable;
assert!;
assert!;
// To avoid panicking on overflow:
assert!;
assert!;
See the list of constants for a list of time units that make
rounding Duration easier.
use ;
use Duration;
assert!;
assert!;
⚠️ Development status
This is in active development. The API may be entirely rewritten. I am open to suggestions.
Minimum supported Rust version
Currently the minimum supported Rust version (MSRV) is 1.56.1. Future increases in the MSRV will require a major version bump.
License
This project dual-licensed under the Apache 2 and MIT licenses. You may choose to use either.
Contributions
Unless you explicitly state otherwise, any contribution you submit as defined in the Apache 2.0 license shall be dual licensed as above, without any additional terms or conditions.