Skip to content

Commit

Permalink
Merge pull request #5 from danielparks/lib-readme
Browse files Browse the repository at this point in the history
Match lib.rs doc comments to README.md.
  • Loading branch information
danielparks authored Mar 15, 2024
2 parents 07a1f0c + ad4a693 commit 502ffdb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
//! # Roundable values
//! # Round numbers and durations to a given factor
//!
//! This provides an implementation of rounding for various values, including
//! [`core::time::Duration`] (or `std::time::Duration`).
//! the 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.
//!
//! ```rust
//! use roundable::Roundable;
//!
//! assert!(310 == 314.round_to(10));
//! assert!(300.0 == 314.1.round_to(100.0));
//!
//! // To avoid panicking on overflow:
//! assert!(Some(260) == 255.try_round_to(10));
//! assert!(None == 255u8.try_round_to(10));
//! ```
//!
//! See [Constants](#constants) for a list of time units that make rounding
//! [`Duration`] easier.
//! See [the list of constants][#constants] for a list of time units that make
//! rounding [`Duration`] easier.
//!
//! ```rust
//! use roundable::{SECOND, MINUTE, Roundable};
Expand Down

0 comments on commit 502ffdb

Please sign in to comment.