From 449d7277b9f719c20ec48d655bdf8aa75f6aeb66 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Mon, 5 Mar 2018 12:57:26 -0800 Subject: [PATCH] Rename SubSecondRound to SubsecRound Per review request. --- src/lib.rs | 4 ++-- src/round.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 57b330e..63c511c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -409,7 +409,7 @@ pub use date::{Date, MIN_DATE, MAX_DATE}; pub use datetime::{DateTime, SecondsFormat}; #[cfg(feature = "rustc-serialize")] pub use datetime::rustc_serialize::TsSeconds; pub use format::{ParseError, ParseResult}; -pub use round::SubSecondRound; +pub use round::SubsecRound; /// A convenience module appropriate for glob imports (`use chrono::prelude::*;`). pub mod prelude { @@ -419,7 +419,7 @@ pub mod prelude { #[doc(no_inline)] pub use {NaiveDate, NaiveTime, NaiveDateTime}; #[doc(no_inline)] pub use Date; #[doc(no_inline)] pub use {DateTime, SecondsFormat}; - #[doc(no_inline)] pub use SubSecondRound; + #[doc(no_inline)] pub use SubsecRound; } // useful throughout the codebase diff --git a/src/round.rs b/src/round.rs index fcdd01e..bf62762 100644 --- a/src/round.rs +++ b/src/round.rs @@ -11,14 +11,14 @@ use oldtime::Duration; /// behavior in Chrono display formatting. Either can be used to guarantee /// equality (e.g. for testing) when round-tripping through a lower precision /// format. -pub trait SubSecondRound { +pub trait SubsecRound { /// Return a copy rounded to the specified number of subsecond digits. With /// 9 or more digits, self is returned unmodified. Halfway values are /// rounded up (away from zero). /// /// # Example /// ``` rust - /// # use chrono::{DateTime, SubSecondRound, Timelike, TimeZone, Utc}; + /// # use chrono::{DateTime, SubsecRound, Timelike, TimeZone, Utc}; /// let dt = Utc.ymd(2018, 1, 11).and_hms_milli(12, 0, 0, 154); /// assert_eq!(dt.round_subsecs(2).nanosecond(), 150_000_000); /// assert_eq!(dt.round_subsecs(1).nanosecond(), 200_000_000); @@ -30,7 +30,7 @@ pub trait SubSecondRound { /// /// # Example /// ``` rust - /// # use chrono::{DateTime, SubSecondRound, Timelike, TimeZone, Utc}; + /// # use chrono::{DateTime, SubsecRound, Timelike, TimeZone, Utc}; /// let dt = Utc.ymd(2018, 1, 11).and_hms_milli(12, 0, 0, 154); /// assert_eq!(dt.trunc_subsecs(2).nanosecond(), 150_000_000); /// assert_eq!(dt.trunc_subsecs(1).nanosecond(), 100_000_000); @@ -38,7 +38,7 @@ pub trait SubSecondRound { fn trunc_subsecs(self, digits: u16) -> Self; } -impl SubSecondRound for T +impl SubsecRound for T where T: Timelike + Add + Sub { fn round_subsecs(self, digits: u16) -> T { @@ -88,7 +88,7 @@ fn span_for_digits(digits: u16) -> u32 { mod tests { use Timelike; use offset::{FixedOffset, TimeZone, Utc}; - use super::SubSecondRound; + use super::SubsecRound; #[test] fn test_round() {