From ca4f211b5a7130424e0ed735137e29b7064f8f98 Mon Sep 17 00:00:00 2001 From: Rik van der Kleij Date: Sun, 19 Jun 2022 20:13:42 +0200 Subject: [PATCH] Expose MIN_TIME and MAX_TIME of NaiveTime --- CHANGELOG.md | 1 + src/lib.rs | 2 +- src/naive/mod.rs | 2 +- src/naive/time/mod.rs | 7 ++++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc3a65642b..71d39534fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Versions with only mechanical changes will be omitted from the following list. * Add support for getting week bounds based on a specific `NaiveDate` and a `Weekday` (#666) * Remove libc dependency from Cargo.toml. * Add the `and_local_timezone` method to `NaiveDateTime` +* Expose `MIN_TIME` and `MAX_TIME` of `NaiveTime` ## 0.4.19 diff --git a/src/lib.rs b/src/lib.rs index b68a25bead..0327b8b26f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -487,7 +487,7 @@ pub use format::{ParseError, ParseResult}; pub mod naive; #[doc(no_inline)] -pub use naive::{IsoWeek, NaiveDate, NaiveDateTime, NaiveTime, NaiveWeek}; +pub use naive::{IsoWeek, NaiveDate, NaiveDateTime, NaiveTime, NaiveWeek, MAX_TIME, MIN_TIME}; pub mod offset; #[cfg(feature = "clock")] diff --git a/src/naive/mod.rs b/src/naive/mod.rs index 171cac36bb..802b973af3 100644 --- a/src/naive/mod.rs +++ b/src/naive/mod.rs @@ -16,7 +16,7 @@ pub use self::date::{NaiveDate, NaiveWeek, MAX_DATE, MIN_DATE}; pub use self::datetime::rustc_serialize::TsSeconds; pub use self::datetime::{NaiveDateTime, MAX_DATETIME, MIN_DATETIME}; pub use self::isoweek::IsoWeek; -pub use self::time::NaiveTime; +pub use self::time::{NaiveTime, MAX_TIME, MIN_TIME}; #[cfg(feature = "__internal_bench")] #[doc(hidden)] diff --git a/src/naive/time/mod.rs b/src/naive/time/mod.rs index 1bcfd03a3a..08e0cd9b23 100644 --- a/src/naive/time/mod.rs +++ b/src/naive/time/mod.rs @@ -28,9 +28,10 @@ mod serde; #[cfg(test)] mod tests; -pub(super) const MIN_TIME: NaiveTime = NaiveTime { secs: 0, frac: 0 }; -pub(super) const MAX_TIME: NaiveTime = - NaiveTime { secs: 23 * 3600 + 59 * 60 + 59, frac: 999_999_999 }; +/// The minimum possible `NaiveTime`. +pub const MIN_TIME: NaiveTime = NaiveTime { secs: 0, frac: 0 }; +/// The maximum possible `NaiveTime`. +pub const MAX_TIME: NaiveTime = NaiveTime { secs: 23 * 3600 + 59 * 60 + 59, frac: 999_999_999 }; /// ISO 8601 time without timezone. /// Allows for the nanosecond precision and optional leap second representation.