From 3c3c546a661ac59e1a586a4edc65adff04fd1335 Mon Sep 17 00:00:00 2001 From: Jacob Pratt Date: Wed, 10 Apr 2024 21:42:24 -0400 Subject: [PATCH] `pub use` instead of `pub type` re-exporting This utilizes `#[cfg(doc)]` such that documentation shows it as a type alias, while the code actually compiled in every other situation is a re-export, avoiding the limitations of rustc. --- CHANGELOG.md | 17 ++++++++++++++--- Cargo.lock | 2 +- time/Cargo.toml | 2 +- .../format_description/borrowed_format_item.rs | 3 +++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce82be009..76390cc41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,21 +6,29 @@ The format is based on [Keep a Changelog]. This project adheres to [Semantic Ver --- +## 0.3.36 [2024-04-10] + +### # Fixed + +- `FormatItem` can be used as part of an import path. See [#675] for details. + +[#675]: https://github.com/time-rs/time/issues/675 + ## 0.3.35 [2024-04-10] -## Added +### Added - `Duration::checked_neg` - `ext::InstantExt`, which provides methods for using `time::Duration` with `std::time::Instant` -## Changed +### Changed - `Instant` is deprecated. It is recommended to use `std::time::Instant` directly, importing `time::ext::InstantExt` for interoperability with `time::Duration`. - `FormatItem` has been renamed to `BorrowedFormatItem`, avoiding confusion with `OwnedFormatItem`. An alias has been added for backwards compatibility. -## Fixed +### Fixed - The weekday is optional when parsing RFC2822. - The range of sub-second values in `Duration` is documented correctly. The previous documentation @@ -382,6 +390,9 @@ This includes the update to the `format_description!` macro, which was supposed - [#481]: `Time` subtracted from `Time` can panic. This was caused by a bug that has always existed, in that an internal invariant was not upheld. Memory safety was not violated. +[#479]: https://github.com/time-rs/time/issues/479 +[#481]: https://github.com/time-rs/time/issues/481 + ## 0.3.10 [2022-06-19] ### Added diff --git a/Cargo.lock b/Cargo.lock index ef67c4c0a..fac6b886d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -580,7 +580,7 @@ dependencies = [ [[package]] name = "time" -version = "0.3.35" +version = "0.3.36" dependencies = [ "criterion", "deranged", diff --git a/time/Cargo.toml b/time/Cargo.toml index a536cef7e..834a5479c 100644 --- a/time/Cargo.toml +++ b/time/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "time" -version = "0.3.35" +version = "0.3.36" authors = ["Jacob Pratt ", "Time contributors"] edition = "2021" rust-version = "1.67.0" diff --git a/time/src/format_description/borrowed_format_item.rs b/time/src/format_description/borrowed_format_item.rs index 4ef5a1756..4f3e6386c 100644 --- a/time/src/format_description/borrowed_format_item.rs +++ b/time/src/format_description/borrowed_format_item.rs @@ -9,12 +9,15 @@ use core::fmt; /// /// This alias exists for backwards-compatibility. It is recommended to use `BorrowedFormatItem` /// for clarity, as it is more explicit that the data is borrowed rather than owned. +#[cfg(doc)] #[deprecated( since = "0.3.35", note = "use `BorrowedFormatItem` instead for clarity" )] pub type FormatItem<'a> = BorrowedFormatItem<'a>; +#[cfg(not(doc))] +pub use self::BorrowedFormatItem as FormatItem; use crate::error; use crate::format_description::Component;