Skip to content

Commit

Permalink
pub use instead of pub type re-exporting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jhpratt committed Apr 11, 2024
1 parent 266178d commit 3c3c546
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion time/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "time"
version = "0.3.35"
version = "0.3.36"
authors = ["Jacob Pratt <open-source@jhpratt.dev>", "Time contributors"]
edition = "2021"
rust-version = "1.67.0"
Expand Down
3 changes: 3 additions & 0 deletions time/src/format_description/borrowed_format_item.rs
Expand Up @@ -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;

Expand Down

0 comments on commit 3c3c546

Please sign in to comment.