From ad4a693842aadef914c4771534ff5885d4a7c68a Mon Sep 17 00:00:00 2001 From: Daniel Parks Date: Thu, 14 Mar 2024 21:00:19 -0700 Subject: [PATCH] Match lib.rs doc comments to README.md. --- src/lib.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4d59dfb..52885a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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};