Rename SubSecondRound to SubsecRound

Per review request.
This commit is contained in:
David Kellum 2018-03-05 12:57:26 -08:00
parent 08b7e0bc6b
commit 449d7277b9
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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<T> SubSecondRound for T
impl<T> SubsecRound for T
where T: Timelike + Add<Duration, Output=T> + Sub<Duration, Output=T>
{
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() {