Optimize Vec::retain#81126
Merged
bors merged 4 commits intorust-lang:masterfrom Feb 11, 2021
Merged
Conversation
Contributor
|
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
m-ou-se
reviewed
Jan 21, 2021
Member
m-ou-se
left a comment
There was a problem hiding this comment.
Thanks for working on this!
I have a few comments:
Contributor
Author
|
@m-ou-se Fixed. Also updated the benchmark result. |
Member
|
@bors r+ |
Collaborator
|
📌 Commit 2a11c57 has been approved by |
Member
|
Thanks for working on this! |
Collaborator
Collaborator
|
☀️ Test successful - checks-actions |
niklasf
added a commit
to niklasf/arrayvec
that referenced
this pull request
Feb 19, 2021
bluss
pushed a commit
to niklasf/arrayvec
that referenced
this pull request
Mar 29, 2021
bluss
added a commit
to bluss/arrayvec
that referenced
this pull request
Mar 29, 2021
Mirror optimization of std::Vec::retain (rust-lang/rust#81126)
This was referenced Dec 13, 2021
This was referenced Dec 21, 2021
This was referenced Feb 24, 2022
This was referenced Mar 18, 2022
This was referenced May 13, 2022
This was referenced Mar 2, 2023
This was referenced Jun 14, 2023
1 task
Boshen
added a commit
to oxc-project/schemars
that referenced
this pull request
May 8, 2026
> **Note:** This PR body was truncated due to platform limits.
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [arrayvec05](https://redirect.github.com/bluss/arrayvec) |
dependencies | minor | `0.5` -> `0.7` |
| [arrayvec07](https://redirect.github.com/bluss/arrayvec) |
dependencies | patch | `0.7.4` -> `0.7.6` |
| [bigdecimal03](https://redirect.github.com/akubera/bigdecimal-rs) |
dependencies | minor | `0.3` -> `0.4` |
| [bigdecimal04](https://redirect.github.com/akubera/bigdecimal-rs) |
dependencies | patch | `0.4.2` -> `0.4.9` |
| [bytes](https://redirect.github.com/tokio-rs/bytes) | dependencies |
minor | `1.5.0` -> `1.11.0` |
| [chrono](https://redirect.github.com/chronotope/chrono) | dependencies
| patch | `0.4.31` -> `0.4.42` |
| [dyn-clone](https://redirect.github.com/dtolnay/dyn-clone) |
dependencies | patch | `1.0.14` -> `1.0.20` |
| [either](https://redirect.github.com/rayon-rs/either) | dependencies |
minor | `1.9.0` -> `1.15.0` |
| [enumset](https://redirect.github.com/Lymia/enumset) | dependencies |
patch | `1.1.3` -> `1.1.10` |
| [indexmap](https://redirect.github.com/indexmap-rs/indexmap) |
dependencies | minor | `1.2.0` -> `1.9.3` |
| [indexmap2](https://redirect.github.com/indexmap-rs/indexmap) |
dependencies | minor | `2.0.2` -> `2.12.1` |
|
[pretty_assertions](https://redirect.github.com/rust-pretty-assertions/rust-pretty-assertions)
| dev-dependencies | patch | `1.4.0` -> `1.4.1` |
| [proc-macro2](https://redirect.github.com/dtolnay/proc-macro2) |
dependencies | patch | `1.0.69` -> `1.0.103` |
| [quote](https://redirect.github.com/dtolnay/quote) | dependencies |
patch | `1.0.33` -> `1.0.42` |
| [rust_decimal](https://redirect.github.com/paupino/rust-decimal) |
dependencies | minor | `1.32.0` -> `1.39.0` |
| [semver](https://redirect.github.com/dtolnay/semver) | dependencies |
patch | `1.0.20` -> `1.0.27` |
| [serde](https://serde.rs)
([source](https://redirect.github.com/serde-rs/serde)) | dependencies |
patch | `1.0.189` -> `1.0.228` |
| [serde_derive_internals](https://serde.rs)
([source](https://redirect.github.com/serde-rs/serde)) | dependencies |
patch | `0.29.0` -> `0.29.1` |
| [serde_json](https://redirect.github.com/serde-rs/json) | dependencies
| patch | `1.0.107` -> `1.0.145` |
| [smallvec](https://redirect.github.com/servo/rust-smallvec) |
dependencies | minor | `1.11.1` -> `1.15.1` |
| [smol_str](https://redirect.github.com/rust-analyzer/smol_str) |
dependencies | minor | `0.1.17` -> `0.3.0` |
| [syn](https://redirect.github.com/dtolnay/syn) | dependencies | patch
| `2.0.38` -> `2.0.111` |
| [trybuild](https://redirect.github.com/dtolnay/trybuild) |
dev-dependencies | patch | `1.0.85` -> `1.0.114` |
| [url](https://redirect.github.com/servo/rust-url) | dependencies |
minor | `2.4.1` -> `2.5.7` |
| [uuid1](https://redirect.github.com/uuid-rs/uuid) | dependencies |
minor | `1.5.0` -> `1.19.0` |
---
### Release Notes
<details>
<summary>bluss/arrayvec (arrayvec05)</summary>
###
[`v0.7.6`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#076)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.7.5...0.7.6)
- Fix no-std build
[#​274](https://redirect.github.com/bluss/arrayvec/pull/274)
###
[`v0.7.5`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#075)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.7.4...0.7.5)
- Add `as_ptr` and `as_mut_ptr` to `ArrayString`
[@​YuhanLiin](https://redirect.github.com/YuhanLiin)
[#​260](https://redirect.github.com/bluss/arrayvec/pull/260)
- Add borsh serialization support by
[@​honzasp](https://redirect.github.com/honzasp) and
[@​Fuuzetsu](https://redirect.github.com/Fuuzetsu)
[#​259](https://redirect.github.com/bluss/arrayvec/pull/259)
- Move length field before before data in ArrayVec and ArrayString by
[@​JakkuSakura](https://redirect.github.com/JakkuSakura)
[#​255](https://redirect.github.com/bluss/arrayvec/pull/255)
- Fix miri error for ZST case in extend by
[@​bluss](https://redirect.github.com/bluss)
- implement AsRef<Path> for ArrayString by
[@​Zoybean](https://redirect.github.com/Zoybean)
[#​218](https://redirect.github.com/bluss/arrayvec/pull/218)
- Fix typos in changelog by
[@​striezel](https://redirect.github.com/striezel)
[#​241](https://redirect.github.com/bluss/arrayvec/pull/241)
- Add `as_slice`, `as_mut_slice` methods to `IntoIter` by
[@​clarfonthey](https://redirect.github.com/clarfonthey)
[#​224](https://redirect.github.com/bluss/arrayvec/pull/224)
###
[`v0.7.4`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#074)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.7.3...0.7.4)
- Add feature zeroize to support the `Zeroize` trait by
[@​elichai](https://redirect.github.com/elichai)
###
[`v0.7.3`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#073)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.7.2...0.7.3)
- Use track\_caller on multiple methods like push and similar, for
capacity
overflows by [@​kornelski](https://redirect.github.com/kornelski)
- impl BorrowMut for ArrayString by
[@​msrd0](https://redirect.github.com/msrd0)
- Fix stacked borrows violations by
[@​clubby789](https://redirect.github.com/clubby789)
- Update Miri CI by
[@​RalfJung](https://redirect.github.com/RalfJung)
###
[`v0.7.2`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#072)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.7.1...0.7.2)
- Add `.as_mut_str()` to `ArrayString` by
[@​clarfonthey](https://redirect.github.com/clarfonthey)
- Add `remaining_capacity` to `ArrayString` by
[@​bhgomes](https://redirect.github.com/bhgomes)
- Add `zero_filled` constructor by
[@​c410-f3r](https://redirect.github.com/c410-f3r)
- Optimize `retain` by
[@​TennyZhuang](https://redirect.github.com/TennyZhuang) and
[@​niklasf](https://redirect.github.com/niklasf)
- Make the following methods `const` by
[@​bhgomes](https://redirect.github.com/bhgomes):
- len
- is\_empty
- capacity
- is\_full
- remaining\_capacity
- CapacityError::new
###
[`v0.7.1`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#071)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.7.0...0.7.1)
- Add new ArrayVec methods `.take()` and `.into_inner_unchecked()` by
[@​conradludgate](https://redirect.github.com/conradludgate)
- `clone_from` now uses `truncate` when needed by
[@​a1phyr](https://redirect.github.com/a1phyr)
###
[`v0.7.0`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#070)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.6.1...0.7.0)
- `fn new_const` is now the way to const-construct arrayvec and
arraystring,
and `fn new` has been reverted to a regular "non-const" function.
This works around performance issue
[#​182](https://redirect.github.com/bluss/arrayvec/issues/182),
where the const fn version did not
optimize well. Change by
[@​bluss](https://redirect.github.com/bluss) with thanks to
[@​rodrimati1992](https://redirect.github.com/rodrimati1992) and
[@​niklasf](https://redirect.github.com/niklasf)
for analyzing the problem.
- The deprecated feature flag `unstable-const-fn` was removed, since
it's not needed
- Optimize `.retain()` by using the same algorithm as in std, change by
[@​niklasf](https://redirect.github.com/niklasf),
issue
[#​174](https://redirect.github.com/bluss/arrayvec/issues/174).
Original optimization in Rust std by
[@​oxalica](https://redirect.github.com/oxalica) in
rust-lang/rust/pull/81126
###
[`v0.6.1`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#061)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.6.0...0.6.1)
- The `ArrayVec::new` and `ArrayString::new` constructors are properly
const fns on stable and the feature flag `unstable-const-fn` is now
deprecated.
by [@​rodrimati1992](https://redirect.github.com/rodrimati1992)
- Small fix to the capacity check macro by
[@​Xaeroxe](https://redirect.github.com/Xaeroxe)
- Typo fix in documentation by
[@​cuviper](https://redirect.github.com/cuviper)
- Small code cleanup by
[@​bluss](https://redirect.github.com/bluss)
###
[`v0.6.0`](https://redirect.github.com/bluss/arrayvec/blob/HEAD/CHANGELOG.md#060)
[Compare
Source](https://redirect.github.com/bluss/arrayvec/compare/0.5.2...0.6.0)
- The **const generics** release 🎉. Arrayvec finally implements what it
wanted to implement, since its first version: a vector backed by an
array,
with generic parameters for the arbitrary element type *and* backing
array
capacity.
The New type syntax is `ArrayVec<T, CAP>` where `CAP` is the arrayvec
capacity.
For arraystring the syntax is `ArrayString<CAP>`.
Length is stored internally as u32; this limits the maximum capacity.
The size
of the `ArrayVec` or `ArrayString` structs for the same capacity may
grow
slightly compared with the previous version (depending on padding
requirements
for the element type). Change by
[@​bluss](https://redirect.github.com/bluss).
- Arrayvec's `.extend()` and `FromIterator`/`.collect()` to arrayvec now
**panic** if the capacity of the arrayvec is exceeded. Change by
[@​bluss](https://redirect.github.com/bluss).
- Arraystring now implements `TryFrom<&str>` and
`TryFrom<fmt::Arguments>` by
[@​c410-f3r](https://redirect.github.com/c410-f3r)
- Minimum supported rust version is Rust 1.51
</details>
<details>
<summary>akubera/bigdecimal-rs (bigdecimal03)</summary>
###
[`v0.4.9`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.9)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.8...v0.4.9)
#### Changes
- Add methods `BigDecimal::{powi, powi_with_context}` for raising a
decimal to a i64 power
- the `powi` uses Default Context
- Add methods `BigDecimal::mul_with_context` for efficient
multiplication to fixed precision
- uses precision and rounding-mode in the Context
- Add method `BigDecimal::decimal_digit_count`, returning number of
decimal digits (i.e. precision) of the number
- Add method `BigDecimal::order_of_magnitude`, returning position of
most significant digit of this decimal
- Add method `BigDecimal::is_one_quickcheck`, returning `Option<bool>`
indicating if the value is `1.0` if it can be calculated without
allocating, or None if too large
- Replaced `is_one` in multiplication methods when used for
optimizations
- Should test if that actually speeds it up
- Eg value `1.00000000000000000000000000000000000000000` is stored
internally as
`[4870020673419870208, 16114848830623546549, 293] E -41` and it's hard
to tell this is equivalent to 1
- Add optimizations to inverse
- small powers of ten will simply flip their scale `1/10e-5 -> 10e5`
- convert to f64 to make initial guess when before iterative algorithm
- Add `Context::invert(&self, BigDecimalRef)`, equivalent to
`BigDecimal::inverse_with_context(&self, &ctx)`
- Still has a bug where rounding ignores sign, affecting floor/ceiling
modes
###
[`v0.4.8`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.8)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.7...v0.4.8)
#### What's Changed
- Fix broken link in README.md by
[@​jonahgao](https://redirect.github.com/jonahgao) in
[#​142](https://redirect.github.com/akubera/bigdecimal-rs/pull/142)
- Fix formatting a "scaled zero" value (eg `0e15 = 0*10^15`) by
[@​drinkcat](https://redirect.github.com/drinkcat) in
[#​145](https://redirect.github.com/akubera/bigdecimal-rs/pull/145)
**Full Changelog**:
<https://github.com/akubera/bigdecimal-rs/compare/v0.4.7...v0.4.8>
###
[`v0.4.7`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.7)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.6...v0.4.7)
#### Changes
- Fixed bug in `BigDecimal::to_f64`
- Impl `num_traits::ToPrimitive` for `BigDecimalRef`
- Added methods `BigDecimal::{ToPlainString,WritePlainString}`
- Added Justfile to repo
###
[`v0.4.6`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.6)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.5...v0.4.6)
##### Changes
- Fix error in formatting code that would skip "carrying the one" when
rounding up series of nines, overflowing
- Improved implementation of sqrt and cbrt
- Uses consistent rounding implementations in formatting and arithmetic
operations
- Add new constructor methods `BigDecimal::from_bigint` &
`BigDecimal::from_biguint`
###
[`v0.4.5`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.5)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.4...v0.4.5)
##### Changes
- Remove restrictions on `num-*` dependencies.
- num-traits and num-bigint need to be specified for users using Rust
versions older than 1.60 (let me know if this should be continued to be
supported)
- Fix some bad assumptions when running in 32 bit mode.
- Uses of `as usize` have been replaced with `as u64`
###
[`v0.4.4`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.4)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.3...v0.4.4)
##### Changes
- Revert formatting semantics to match Rust's meanings rather than
Python's
- The meaning of the formatting string `"{:.4}"` has returned to "4
digits after decimal place" rather than "four digits of precision"
- Add new compile-time parameters for safer formatting
- Configurable thresholds prevent printing out full decimal form of
large numbers, like
[`1e99999`](https://redirect.github.com/akubera/bigdecimal-rs/commit/1e999999999999999)
(could be used in)
- Improved JSON serialization / formatting routines
> \[!NOTE]
> Please add your own tests to ensure this library formats (and
continues to format) numbers as you expect
- Added methods
- `BigDecimalRef::clone_into`
- `BigDecimal::set_scale` (mutable version of `take_and_scale`)
- Optimized bigdecimal comparison algorithms
- Restricted versions of num-\* crates to respect Minimum Supported Rust
Version (1.43)
- I may raise this up soon
###
[`v0.4.3`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.3)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.2...v0.4.3)
##### Changes
- Use exponential formatting (scientific-notation) if number of leading
zeros is greater than 5
- so `1234e-304` is formatted as `1.234e-301` rather than
`0.00.....(300-zeros)....00123`
- Fixes "out of memory errors" when massive amounts of zeros would have
been printed
- Add methods for printing using scientific-notation &
engineering-notation
- Add derived Clone trait to ParseBigDecimalError
- Preserve scale when adding zero
- Mimics Python's Decimal behavior:
```python
>>> Decimal("1.2") + Decimal("0.00000")
Decimal('1.20000')
```
- Minor optimizations removing unnecessary clones in addition and
multiplication
###
[`v0.4.2`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.2)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.1...v0.4.2)
#### Changes
- Add ***Context*** struct
- For user-controlled precision and rounding
- Support for a few BigDecimal functions added (eg:
`sqrt_with_context(&self, ctx: &Context)`) , more to come in future
versions.
- Note standard operations use default (compile-time-defined) context
- Add ***BigDecimalRef*** struct
- Non-owning BigDecimal struct that has some non-digit-changing methods
(i.e. change sign/scale without copying digits) for more efficient
calculations
- Implements math operations `Add,Sub`
- Implement `From<&BigInt> for BigDecimalRef`
- Compile-time default rounding mode may be set by environment variable
`RUST_BIGDECIMAL_DEFAULT_ROUNDING_MODE`
- Fix issue recompiling if `RUST_BIGDECIMAL_DEFAULT_PRECISION` haddn't
changed
- Add `BigDecimal::with_precision_round()`
- trim the bigdecimal after operations, rounding at given point
- Add `BigDecimal::fractional_digit_count()`
- Return's the bigdecimal's "scale", (number of digits right of the
decimal point)
- Support reading subnormal floating-point numbers
- Improve initial "guess" in calculation of inverted value.
- Fix panic in from\_str\_radix
([#​115](https://redirect.github.com/akubera/bigdecimal-rs/issues/115))
- (internal) Reorganize std::ops implementations by moving each to
separate functions (`src/impl_ops_add.rs`, `src/impl_ops_sub.rs`, etc)
##### Performance Improvements
- `BigDecimal::eq` takes into account trailing zeros, avoids aligning
digits
- (internal) `ten_to_the` - used everywhere to align BigIntegers within
BigDecimals, all operations with high precision numbers should be faster
###
[`v0.4.1`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.1)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.4.0...v0.4.1)
#### Changes
- Fix issue where RUST\_BIGDECIMAL\_DEFAULT\_PRECISION envar would
always
trigger a rebuild
- Fix issue where .neg() could be called on {signed-int}::MIN values
- Add implementations of Add/Sub/Mul/Div for primitive values
- Use 'proptest' crate to improve arithmetic testing
###
[`v0.4.0`](https://redirect.github.com/akubera/bigdecimal-rs/releases/tag/v0.4.0)
[Compare
Source](https://redirect.github.com/akubera/bigdecimal-rs/compare/v0.3.1...v0.4.0)
#### Changes
- `no_std` feature support
[#​97](https://redirect.github.com/akubera/bigdecimal-rs/pull/97)
- To disable std, change your Cargo.toml dependency to:\
`bigdecimal = { version = "0.4", default-features = false }`
- Still depends on alloc (I think we will always need dynamic storage)
- Allow user to set default max-precision at compile time
- Use environment variable `RUST_BIGDECIMAL_DEFAULT_PRECISION`
- Defaults to 100
- This "is the number of 3s in calculation of 1/3"
- Better solutions are being considered
- This is tricky: Do we set a global variable? Do we require every math
operation to specify precision? Do we store precision in each
BigDecimal? Is *that* set from a global variable? Should we use macros
to balance explicit precision and tidy code?
- Add [rounding
module](https://redirect.github.com/akubera/bigdecimal-rs/blob/2977cf9690dcf0b30347982bd9cab1dd04f250c6/src/rounding.rs)
with `RoundingMode` enum
- Used in new method:
[BigDecimal::with\_scale\_round](https://redirect.github.com/akubera/bigdecimal-rs/blob/2977cf9690dcf0b30347982bd9cab1dd04f250c6/src/lib.rs#L256C10-L256C10)
- Finally, you can truncate your decimal with the rounding you prefer!
- Will be coming to more methods, soon
- Reimplement parsing from {32,64}-bit float values
- Use binary bits instead of formatting to string and parsing
- Already surprising users:
[#​103](https://redirect.github.com/akubera/bigdecimal-rs/issues/103)
- Bump *Minimum Supported Rust Version* from 1.34 to 1.43
- Was breaking a few test dependencies
- Able to do more at compile time
- Probably wont affect too many people?
- Fix implementations of to\_u128/to\_i128
[#​101](https://redirect.github.com/akubera/bigdecimal-rs/pull/101)
- Default implementations cast values to 64 bit ints
- Fix issue where underscores after the decimal counted towards total
digit count (giving wrong exponent)
[#​99](https://redirect.github.com/akubera/bigdecimal-rs/pull/99)
- Fix case of panic during rounding
[#​90](https://redirect.github.com/akubera/bigdecimal-rs/issues/90)
- Add preliminary benchmarking code
- Unsatisfied with statistics: more work to be done with Criterion
- Eventually get some answers on how best to parse strings, and in what
format should the digits be stored
- Started using my [crazy approach to unit
testing](https://redirect.github.com/akubera/bigdecimal-rs/blob/2977cf9690dcf0b30347982bd9cab1dd04f250c6/src/parsing.tests.parse_from_f32.rs)
</details>
<details>
<summary>tokio-rs/bytes (bytes)</summary>
###
[`v1.11.0`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#1110-November-14th-2025)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.10.1...v1.11.0)
- Bump MSRV to 1.57
([#​788](https://redirect.github.com/tokio-rs/bytes/issues/788))
##### Fixed
- fix: `BytesMut` only reuse if src has remaining
([#​803](https://redirect.github.com/tokio-rs/bytes/issues/803))
- Specialize `BytesMut::put::<Bytes>`
([#​793](https://redirect.github.com/tokio-rs/bytes/issues/793))
- Reserve capacity in `BytesMut::put`
([#​794](https://redirect.github.com/tokio-rs/bytes/issues/794))
- Change `BytesMut::remaining_mut` to use `isize::MAX` instead of
`usize::MAX`
([#​795](https://redirect.github.com/tokio-rs/bytes/issues/795))
##### Internal changes
- Guarantee address in `slice()` for empty slices.
([#​780](https://redirect.github.com/tokio-rs/bytes/issues/780))
- Rename `Vtable::to_*` -> `Vtable::into_*`
([#​776](https://redirect.github.com/tokio-rs/bytes/issues/776))
- Fix latest clippy warnings
([#​787](https://redirect.github.com/tokio-rs/bytes/issues/787))
- Ignore `BytesMut::freeze` doctest on wasm
([#​790](https://redirect.github.com/tokio-rs/bytes/issues/790))
- Move `drop_fn` of `from_owner` into vtable
([#​801](https://redirect.github.com/tokio-rs/bytes/issues/801))
###
[`v1.10.1`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#1101-March-5th-2025)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.10.0...v1.10.1)
##### Fixed
- Fix memory leak when using `to_vec` with `Bytes::from_owner`
([#​773](https://redirect.github.com/tokio-rs/bytes/issues/773))
###
[`v1.10.0`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#1100-February-3rd-2025)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.9.0...v1.10.0)
##### Added
- Add feature to support platforms without atomic CAS
([#​467](https://redirect.github.com/tokio-rs/bytes/issues/467))
- `try_get_*` methods for `Buf` trait
([#​753](https://redirect.github.com/tokio-rs/bytes/issues/753))
- Implement `Buf::chunks_vectored` for `Take`
([#​617](https://redirect.github.com/tokio-rs/bytes/issues/617))
- Implement `Buf::chunks_vectored` for `VecDeque<u8>`
([#​708](https://redirect.github.com/tokio-rs/bytes/issues/708))
##### Fixed
- Remove incorrect guarantee for `chunks_vectored`
([#​754](https://redirect.github.com/tokio-rs/bytes/issues/754))
- Ensure that tests pass under `panic=abort`
([#​749](https://redirect.github.com/tokio-rs/bytes/issues/749))
###
[`v1.9.0`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#190-November-27-2024)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.8.0...v1.9.0)
##### Added
- Add `Bytes::from_owner` to enable externally-allocated memory
([#​742](https://redirect.github.com/tokio-rs/bytes/issues/742))
##### Documented
- Fix typo in Buf::chunk() comment
([#​744](https://redirect.github.com/tokio-rs/bytes/issues/744))
##### Internal changes
- Replace BufMut::put with BufMut::put\_slice in Writer impl
([#​745](https://redirect.github.com/tokio-rs/bytes/issues/745))
- Rename hex\_impl! to fmt\_impl! and reuse it for fmt::Debug
([#​743](https://redirect.github.com/tokio-rs/bytes/issues/743))
###
[`v1.8.0`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#180-October-21-2024)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.7.2...v1.8.0)
- Guarantee address in `split_off`/`split_to` for empty slices
([#​740](https://redirect.github.com/tokio-rs/bytes/issues/740))
###
[`v1.7.2`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#172-September-17-2024)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.7.1...v1.7.2)
##### Fixed
- Fix default impl of `Buf::{get_int, get_int_le}`
([#​732](https://redirect.github.com/tokio-rs/bytes/issues/732))
##### Documented
- Fix double spaces in comments and doc comments
([#​731](https://redirect.github.com/tokio-rs/bytes/issues/731))
##### Internal changes
- Ensure BytesMut::advance reduces capacity
([#​728](https://redirect.github.com/tokio-rs/bytes/issues/728))
###
[`v1.7.1`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#171-August-1-2024)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.7.0...v1.7.1)
This release reverts the following change due to a regression:
- Reuse capacity when possible in `<BytesMut as Buf>::advance` impl
([#​698](https://redirect.github.com/tokio-rs/bytes/issues/698))
The revert can be found at
[#​726](https://redirect.github.com/tokio-rs/bytes/issues/726).
###
[`v1.7.0`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#170-July-31-2024)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.6.1...v1.7.0)
##### Added
- Add conversion from `Bytes` to `BytesMut`
([#​695](https://redirect.github.com/tokio-rs/bytes/issues/695),
[#​710](https://redirect.github.com/tokio-rs/bytes/issues/710))
- Add reclaim method without additional allocation
([#​686](https://redirect.github.com/tokio-rs/bytes/issues/686))
##### Documented
- Clarify how `BytesMut::zeroed` works
([#​714](https://redirect.github.com/tokio-rs/bytes/issues/714))
- Clarify the behavior of `Buf::chunk`
([#​717](https://redirect.github.com/tokio-rs/bytes/issues/717))
##### Changed
- Change length condition of `BytesMut::truncate`
- Reuse capacity when possible in `<BytesMut as Buf>::advance` impl
([#​698](https://redirect.github.com/tokio-rs/bytes/issues/698))
- Improve `must_use` suggestion of `BytesMut::split`
([#​699](https://redirect.github.com/tokio-rs/bytes/issues/699))
##### Internal changes
- Use `ManuallyDrop` instead of `mem::forget`
([#​678](https://redirect.github.com/tokio-rs/bytes/issues/678))
- Don't set `len` in `BytesMut::reserve`
([#​682](https://redirect.github.com/tokio-rs/bytes/issues/682))
- Optimize `Bytes::copy_to_bytes`
([#​688](https://redirect.github.com/tokio-rs/bytes/issues/688))
- Refactor `BytesMut::truncate`
([#​694](https://redirect.github.com/tokio-rs/bytes/issues/694))
- Refactor `BytesMut::resize`
([#​696](https://redirect.github.com/tokio-rs/bytes/issues/696))
- Reorder assertion in `Bytes::split_to`, `Bytes::split_off`
([#​689](https://redirect.github.com/tokio-rs/bytes/issues/689),
[#​693](https://redirect.github.com/tokio-rs/bytes/issues/693))
- Use `offset_from` in more places
([#​705](https://redirect.github.com/tokio-rs/bytes/issues/705))
- Correct the wrong usage of `IntoIter`
([#​707](https://redirect.github.com/tokio-rs/bytes/issues/707))
###
[`v1.6.1`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#161-July-13-2024)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.6.0...v1.6.1)
This release fixes a bug where `Bytes::is_unique` returns incorrect
values when
the `Bytes` originates from a shared `BytesMut`.
([#​718](https://redirect.github.com/tokio-rs/bytes/issues/718))
###
[`v1.6.0`](https://redirect.github.com/tokio-rs/bytes/blob/HEAD/CHANGELOG.md#160-March-22-2024)
[Compare
Source](https://redirect.github.com/tokio-rs/bytes/compare/v1.5.0...v1.6.0)
##### Added
- Add `Bytes::is_unique`
([#​643](https://redirect.github.com/tokio-rs/bytes/issues/643))
##### Documented
- Fix changelog typo
([#​628](https://redirect.github.com/tokio-rs/bytes/issues/628))
- Fix some spelling mistakes
([#​633](https://redirect.github.com/tokio-rs/bytes/issues/633))
- Typo fix
([#​637](https://redirect.github.com/tokio-rs/bytes/issues/637))
- Fix broken links
([#​639](https://redirect.github.com/tokio-rs/bytes/issues/639))
- Add security policy
([#​649](https://redirect.github.com/tokio-rs/bytes/issues/649))
##### Internal changes
- Move comment to correct constant
([#​629](https://redirect.github.com/tokio-rs/bytes/issues/629))
- Various cleanup
([#​635](https://redirect.github.com/tokio-rs/bytes/issues/635))
- Simplify `UninitSlice::as_uninit_slice_mut()` logic
([#​644](https://redirect.github.com/tokio-rs/bytes/issues/644))
- Use `self.` instead of `Self::`
([#​642](https://redirect.github.com/tokio-rs/bytes/issues/642))
- `BytesMut`: Assert alignment of `Shared`
([#​652](https://redirect.github.com/tokio-rs/bytes/issues/652))
- Remove unnecessary namespace qualifier
([#​660](https://redirect.github.com/tokio-rs/bytes/issues/660))
- Remove an unnecessary else branch
([#​662](https://redirect.github.com/tokio-rs/bytes/issues/662))
- Remove unreachable else branch
([#​661](https://redirect.github.com/tokio-rs/bytes/issues/661))
- make parameter mut in `From<Vec>`
([#​667](https://redirect.github.com/tokio-rs/bytes/issues/667))
- Restore commented tests
([#​665](https://redirect.github.com/tokio-rs/bytes/issues/665))
- Use `sub` instead of `offset`
([#​668](https://redirect.github.com/tokio-rs/bytes/issues/668))
- Calculate original capacity only if necessary
([#​666](https://redirect.github.com/tokio-rs/bytes/issues/666))
- `set_vec_pos` does not need a second parameter
([#​672](https://redirect.github.com/tokio-rs/bytes/issues/672))
- `get_vec_pos`: use `&self` instead of `&mut self`
([#​670](https://redirect.github.com/tokio-rs/bytes/issues/670))
- Refactor `split_at`/`split_to`
([#​663](https://redirect.github.com/tokio-rs/bytes/issues/663))
- Use `Iterator` from the prelude
([#​673](https://redirect.github.com/tokio-rs/bytes/issues/673))
- `copy_to_bytes`: Add panic section to docs
([#​676](https://redirect.github.com/tokio-rs/bytes/issues/676))
- Remove redundant reserve call
([#​674](https://redirect.github.com/tokio-rs/bytes/issues/674))
- Use `ManuallyDrop` instead of `mem::forget`
([#​675](https://redirect.github.com/tokio-rs/bytes/issues/675))
</details>
<details>
<summary>chronotope/chrono (chrono)</summary>
###
[`v0.4.42`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.42):
0.4.42
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.41...v0.4.42)
#### What's Changed
- Add fuzzer for DateTime::parse\_from\_str by
[@​tyler92](https://redirect.github.com/tyler92) in
[#​1700](https://redirect.github.com/chronotope/chrono/pull/1700)
- Fix wrong amount of micro/milliseconds by
[@​nmlt](https://redirect.github.com/nmlt) in
[#​1703](https://redirect.github.com/chronotope/chrono/pull/1703)
- Add warning about MappedLocalTime and wasm by
[@​lutzky](https://redirect.github.com/lutzky) in
[#​1702](https://redirect.github.com/chronotope/chrono/pull/1702)
- Fix incorrect parsing of fixed-length second fractions by
[@​chris-leach](https://redirect.github.com/chris-leach) in
[#​1705](https://redirect.github.com/chronotope/chrono/pull/1705)
- Fix cfgs for `wasm32-linux` support by
[@​arjunr2](https://redirect.github.com/arjunr2) in
[#​1707](https://redirect.github.com/chronotope/chrono/pull/1707)
- Fix OpenHarmony's `tzdata` parsing by
[@​ldm0](https://redirect.github.com/ldm0) in
[#​1679](https://redirect.github.com/chronotope/chrono/pull/1679)
- Convert NaiveDate to/from days since unix epoch by
[@​findepi](https://redirect.github.com/findepi) in
[#​1715](https://redirect.github.com/chronotope/chrono/pull/1715)
- Add `?Sized` bound to related methods of `DelayedFormat::write_to` by
[@​Huliiiiii](https://redirect.github.com/Huliiiiii) in
[#​1721](https://redirect.github.com/chronotope/chrono/pull/1721)
- Add `from_timestamp_secs` method to `DateTime` by
[@​jasonaowen](https://redirect.github.com/jasonaowen) in
[#​1719](https://redirect.github.com/chronotope/chrono/pull/1719)
- Migrate to core::error::Error by
[@​benbrittain](https://redirect.github.com/benbrittain) in
[#​1704](https://redirect.github.com/chronotope/chrono/pull/1704)
- Upgrade to windows-bindgen 0.63 by
[@​djc](https://redirect.github.com/djc) in
[#​1730](https://redirect.github.com/chronotope/chrono/pull/1730)
- strftime: simplify error handling by
[@​djc](https://redirect.github.com/djc) in
[#​1731](https://redirect.github.com/chronotope/chrono/pull/1731)
###
[`v0.4.41`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.41)
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.40...v0.4.41)
#### What's Changed
- Add `subsec_micros` and `subsec_millis` methods to `TimeDelta` by
[@​ggoetz](https://redirect.github.com/ggoetz) in
[#​1668](https://redirect.github.com/chronotope/chrono/pull/1668)
- Deprecate `NaiveDateTime::UNIX_EPOCH` by
[@​robertbastian](https://redirect.github.com/robertbastian) in
[#​1670](https://redirect.github.com/chronotope/chrono/pull/1670)
- Implement `as_seconds_f32` and `as_seconds_f64` for `TimeDelta` by
[@​ggoetz](https://redirect.github.com/ggoetz) in
[#​1671](https://redirect.github.com/chronotope/chrono/pull/1671)
- chore: fix some comments by
[@​jimmycathy](https://redirect.github.com/jimmycathy) in
[#​1677](https://redirect.github.com/chronotope/chrono/pull/1677)
- Add `num_days_in_month` method to `Datelike` trait by
[@​aslilac](https://redirect.github.com/aslilac) in
[#​1673](https://redirect.github.com/chronotope/chrono/pull/1673)
- add `WeekdaySet`, a collection of `Weekday` that is `Copy` by
[@​Kinrany](https://redirect.github.com/Kinrany) in
[#​1676](https://redirect.github.com/chronotope/chrono/pull/1676)
- WeekdaySet tweaks by [@​djc](https://redirect.github.com/djc) in
[#​1680](https://redirect.github.com/chronotope/chrono/pull/1680)
- Upgrade to windows-bindgen 0.61 by
[@​djc](https://redirect.github.com/djc) in
[#​1682](https://redirect.github.com/chronotope/chrono/pull/1682)
- Implemented a consistent Eq trait for NaiveWeek by
[@​Splashling1789](https://redirect.github.com/Splashling1789) in
[#​1687](https://redirect.github.com/chronotope/chrono/pull/1687)
- TimeZone::from\_posix\_tz: Treat empty TZ variable as UTC by
[@​drinkcat](https://redirect.github.com/drinkcat) in
[#​1691](https://redirect.github.com/chronotope/chrono/pull/1691)
- Add support for lossy format strings by
[@​Qelxiros](https://redirect.github.com/Qelxiros) in
[#​1693](https://redirect.github.com/chronotope/chrono/pull/1693)
###
[`v0.4.40`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.40):
0.4.40
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.39...v0.4.40)
#### What's Changed
- Add Month::num\_days() by
[@​djc](https://redirect.github.com/djc) in
[#​1645](https://redirect.github.com/chronotope/chrono/pull/1645)
- Update Windows dependencies by
[@​kennykerr](https://redirect.github.com/kennykerr) in
[#​1646](https://redirect.github.com/chronotope/chrono/pull/1646)
- Feature/round\_up method on DurationRound trait by
[@​MagnumTrader](https://redirect.github.com/MagnumTrader) in
[#​1651](https://redirect.github.com/chronotope/chrono/pull/1651)
- Expose `write_to` for `DelayedFormat` by
[@​tugtugtug](https://redirect.github.com/tugtugtug) in
[#​1654](https://redirect.github.com/chronotope/chrono/pull/1654)
- Update LICENSE.txt by
[@​maximevtush](https://redirect.github.com/maximevtush) in
[#​1656](https://redirect.github.com/chronotope/chrono/pull/1656)
- docs: fix minor typo by
[@​samfolo](https://redirect.github.com/samfolo) in
[#​1659](https://redirect.github.com/chronotope/chrono/pull/1659)
- Use NaiveDateTime for internal tz\_info methods. by
[@​AVee](https://redirect.github.com/AVee) in
[#​1658](https://redirect.github.com/chronotope/chrono/pull/1658)
- Upgrade to windows-bindgen 0.60 by
[@​djc](https://redirect.github.com/djc) in
[#​1665](https://redirect.github.com/chronotope/chrono/pull/1665)
- Add quarter (%q) date string specifier by
[@​drinkcat](https://redirect.github.com/drinkcat) in
[#​1666](https://redirect.github.com/chronotope/chrono/pull/1666)
###
[`v0.4.39`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.39):
0.4.39
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.38...v0.4.39)
#### What's Changed
-
[#​1577](https://redirect.github.com/chronotope/chrono/issues/1577):
Changed years\_since documentation to match its implementation by
[@​Taxalo](https://redirect.github.com/Taxalo) in
[#​1578](https://redirect.github.com/chronotope/chrono/pull/1578)
- Remove obsolete weird feature guard by
[@​djc](https://redirect.github.com/djc) in
[#​1582](https://redirect.github.com/chronotope/chrono/pull/1582)
- Fix format::strftime docs link by
[@​frederikhors](https://redirect.github.com/frederikhors) in
[#​1581](https://redirect.github.com/chronotope/chrono/pull/1581)
- Fix micros (optional) limit in and\_hms\_micro\_opt by
[@​qrilka](https://redirect.github.com/qrilka) in
[#​1584](https://redirect.github.com/chronotope/chrono/pull/1584)
- Update windows-bindgen requirement from 0.56 to 0.57 by
[@​dependabot](https://redirect.github.com/dependabot) in
[#​1589](https://redirect.github.com/chronotope/chrono/pull/1589)
- native/date: Improve DelayedFormat doc re Panics by
[@​behnam-oneschema](https://redirect.github.com/behnam-oneschema)
in
[#​1590](https://redirect.github.com/chronotope/chrono/pull/1590)
- Fix typo in rustdoc of `from_timestamp_nanos()` by
[@​sgoll](https://redirect.github.com/sgoll) in
[#​1591](https://redirect.github.com/chronotope/chrono/pull/1591)
- Update windows-bindgen requirement from 0.57 to 0.58 by
[@​dependabot](https://redirect.github.com/dependabot) in
[#​1594](https://redirect.github.com/chronotope/chrono/pull/1594)
- docs: document century cutoff for %y by
[@​MarcoGorelli](https://redirect.github.com/MarcoGorelli) in
[#​1598](https://redirect.github.com/chronotope/chrono/pull/1598)
- Checked `NaiveWeek` methods by
[@​bragov4ik](https://redirect.github.com/bragov4ik) in
[#​1600](https://redirect.github.com/chronotope/chrono/pull/1600)
- Impl serde::Serialize and serde::Deserialize for TimeDelta by
[@​Awpteamoose](https://redirect.github.com/Awpteamoose) in
[#​1599](https://redirect.github.com/chronotope/chrono/pull/1599)
- Derive `PartialEq`,`Eq`,`Hash`,`Copy` and `Clone` on `NaiveWeek` by
[@​DSeeLP](https://redirect.github.com/DSeeLP) in
[#​1618](https://redirect.github.com/chronotope/chrono/pull/1618)
- Support ohos tzdata since ver.oh35 by
[@​MirageLyu](https://redirect.github.com/MirageLyu) in
[#​1613](https://redirect.github.com/chronotope/chrono/pull/1613)
- Use Formatter::pad (instead of write\_str) for Weekdays by
[@​horazont](https://redirect.github.com/horazont) in
[#​1621](https://redirect.github.com/chronotope/chrono/pull/1621)
- Fix typos by
[@​szepeviktor](https://redirect.github.com/szepeviktor) in
[#​1623](https://redirect.github.com/chronotope/chrono/pull/1623)
- Fix comment. by [@​khuey](https://redirect.github.com/khuey) in
[#​1624](https://redirect.github.com/chronotope/chrono/pull/1624)
- chore: add `#[inline]` to `num_days` by
[@​CommanderStorm](https://redirect.github.com/CommanderStorm) in
[#​1627](https://redirect.github.com/chronotope/chrono/pull/1627)
- fix typo by [@​futreall](https://redirect.github.com/futreall)
in
[#​1633](https://redirect.github.com/chronotope/chrono/pull/1633)
- Update mod.rs by
[@​donatik27](https://redirect.github.com/donatik27) in
[#​1638](https://redirect.github.com/chronotope/chrono/pull/1638)
###
[`v0.4.38`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.38)
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.37...v0.4.38)
This release bring a ca. 20% improvement to the performance of the
formatting code, and a convenient `days_since` method for the `Weekday`
type.
Chrono 0.4.38 also removes the long deprecated `rustc-serialize`
feature. Support for `rustc-serialize` will be [soft-destabilized in the
next Rust
edition](https://redirect.github.com/rust-lang/rust/pull/116016).
Removing the feature will not break existing users of the feature; Cargo
will just not update dependents that rely on it to newer versions of
chrono.
In chrono 0.4.36 we made an accidental breaking change by switching to
`derive(Copy)` for `DateTime` instead of a manual implementation. It is
reverted in this release.
### Removals
- Remove `rustc-serialize` feature
([#​1548](https://redirect.github.com/chronotope/chrono/issues/1548),
thanks
[@​workingjubilee](https://redirect.github.com/workingjubilee))
### Additions
- Add `Weekday::days_since`
([#​1249](https://redirect.github.com/chronotope/chrono/issues/1249),
based on
[#​216](https://redirect.github.com/chronotope/chrono/issues/216)
by [@​clarfonthey](https://redirect.github.com/clarfonthey))
- Add `TimeDelta::checked_mul` and `TimeDelta::checked_div`
([#​1565](https://redirect.github.com/chronotope/chrono/issues/1565),
thanks [@​Zomtir](https://redirect.github.com/Zomtir))
### Fixes
- Return error when rounding with a zero duration
([#​1474](https://redirect.github.com/chronotope/chrono/issues/1474),
thanks [@​Dav1dde](https://redirect.github.com/Dav1dde))
- Manually implement `Copy` for `DateTime` if offset is `Copy`
([#​1573](https://redirect.github.com/chronotope/chrono/issues/1573))
### Internal
- Inline `test_encodable_json` and `test_decodable_json` functions
([#​1550](https://redirect.github.com/chronotope/chrono/issues/1550))
- CI: Reduce combinations in `cargo hack check`
([#​1553](https://redirect.github.com/chronotope/chrono/issues/1553))
- Refactor formatting code
([#​1335](https://redirect.github.com/chronotope/chrono/issues/1335))
- Optimize number formatting
([#​1558](https://redirect.github.com/chronotope/chrono/issues/1558))
- Only package files needed for building and testing
([#​1554](https://redirect.github.com/chronotope/chrono/issues/1554))
Thanks to all contributors on behalf of the chrono team,
[@​djc](https://redirect.github.com/djc) and
[@​pitdicker](https://redirect.github.com/pitdicker)!
###
[`v0.4.37`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.37)
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.36...v0.4.37)
Version 0.4.36 introduced an unexpected breaking change and was yanked.
In it `LocalResult` was renamed to `MappedLocalTime` to avoid the
impression that it is a `Result` type were some of the results are
errors. For backwards compatibility a type alias with the old name was
added.
As it turns out there is one case where a type alias behaves differently
from the regular enum: you can't import enum variants from a type alias
with `use chrono::LocalResult::*`. With 0.4.37 we make the new name
`MappedLocalTime` the alias, but keep using it in function signatures
and the documentation as much as possible.
See also the release notes of [chrono
0.4.36](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.36)
from yesterday for the yanked release.
###
[`v0.4.36`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.36)
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.35...v0.4.36)
This release un-deprecates the methods on `TimeDelta` that were
deprecated with the 0.4.35 release because of the churn they are causing
for the ecosystem.
New is the `DateTime::with_time()` method. As an example of when it is
useful:
```rust
use chrono::{Local, NaiveTime};
// Today at 12:00:00
let today_noon = Local::now().with_time(NaiveTime::from_hms_opt(12, 0, 0).unwrap());
```
### Additions
- Add `DateTime::with_time()`
([#​1510](https://redirect.github.com/chronotope/chrono/issues/1510))
### Deprecations
- Revert `TimeDelta` deprecations
([#​1543](https://redirect.github.com/chronotope/chrono/issues/1543))
- Deprecate `TimeStamp::timestamp_subsec_nanos`, which was missed in the
0.4.35 release
([#​1486](https://redirect.github.com/chronotope/chrono/issues/1486))
### Documentation
- Correct version number of deprecation notices
([#​1486](https://redirect.github.com/chronotope/chrono/issues/1486))
- Fix some typos
([#​1505](https://redirect.github.com/chronotope/chrono/issues/1505))
- Slightly improve serde documentation
([#​1519](https://redirect.github.com/chronotope/chrono/issues/1519))
- Main documentation: simplify links and reflow text
([#​1535](https://redirect.github.com/chronotope/chrono/issues/1535))
### Internal
- CI: Lint benchmarks
([#​1489](https://redirect.github.com/chronotope/chrono/issues/1489))
- Remove unnessary `Copy` and `Send` impls
([#​1492](https://redirect.github.com/chronotope/chrono/issues/1492),
thanks [@​erickt](https://redirect.github.com/erickt))
- Backport streamlined `NaiveDate` unit tests
([#​1500](https://redirect.github.com/chronotope/chrono/issues/1500),
thanks [@​Zomtir](https://redirect.github.com/Zomtir))
- Rename `LocalResult` to `TzResolution`, add alias
([#​1501](https://redirect.github.com/chronotope/chrono/issues/1501))
- Update windows-bindgen to 0.55
([#​1504](https://redirect.github.com/chronotope/chrono/issues/1504))
- Avoid duplicate imports, which generate warnings on nightly
([#​1507](https://redirect.github.com/chronotope/chrono/issues/1507))
- Add extra debug assertions to `NaiveDate::from_yof`
([#​1518](https://redirect.github.com/chronotope/chrono/issues/1518))
- Some small simplifications to `DateTime::date_naive` and
`NaiveDate::diff_months`
([#​1530](https://redirect.github.com/chronotope/chrono/issues/1530))
- Remove `unwrap` in Unix `Local` type
([#​1533](https://redirect.github.com/chronotope/chrono/issues/1533))
- Use different method to ignore feature-dependent doctests
([#​1534](https://redirect.github.com/chronotope/chrono/issues/1534))
Thanks to all contributors on behalf of the chrono team,
[@​djc](https://redirect.github.com/djc) and
[@​pitdicker](https://redirect.github.com/pitdicker)!
###
[`v0.4.35`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.35)
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.34...v0.4.35)
Most of our efforts have shifted to improving the API for a 0.5 release,
for which cleanups and refactorings are landing on the 0.4.x branch.
The most significant changes in this release are two sets of
deprecations.
- We deprecated all timestamp-related methods on `NaiveDateTime`. The
reason is that a timestamp is defined to be in UTC. The `NaiveDateTime`
type doesn't know the offset from UTC, so it was technically wrong to
have these methods. The alternative is to use the similar methods on the
`DateTime<Utc>` type, or from the `TimeZone` trait.
Converting from `NaiveDateTime` to `DateTime<Utc>` is simple with
`.and_utc()`, and in the other direction with `.naive_utc()`.
- The panicking constructors of `TimeDelta` (the new name of the
`Duration` type) are deprecated. This was the last part of chrono that
defaulted to panicking on error, dating from before rust 1.0.
- A nice change is that `NaiveDate` now includes a niche. So now
`Option<NaiveDate>`, `Option<NaiveDateTime>` and `Option<DateTime<Tz>>`
are the same size as their base types.
- `format::Numeric` and `format::Fixed` are marked as `non_exhaustive`.
This will allow us to improve our formatting and parsing support, and we
have reason to believe this breaking change will have little to no
impact on users.
### Additions
- Add `DateTime::{from_timestamp_micros, from_timestamp_nanos}`
([#​1234](https://redirect.github.com/chronotope/chrono/issues/1234))
- Add getters to `Parsed`
([#​1465](https://redirect.github.com/chronotope/chrono/issues/1465))
### Deprecations
- Deprecate timestamp methods on `NaiveDateTime`
([#​1473](https://redirect.github.com/chronotope/chrono/issues/1473))
- Deprecate panicking constructors of `TimeDelta`
([#​1450](https://redirect.github.com/chronotope/chrono/issues/1450))
### Changes/fixes
- Use `NonZeroI32` inside `NaiveDate`
([#​1207](https://redirect.github.com/chronotope/chrono/issues/1207))
- Mark `format::Numeric` and `format::Fixed` as `non_exhaustive`
([#​1430](https://redirect.github.com/chronotope/chrono/issues/1430))
- `Parsed` fixes to error values
([#​1439](https://redirect.github.com/chronotope/chrono/issues/1439))
- Use `overflowing_naive_local` in `DateTime::checked_add*`
([#​1333](https://redirect.github.com/chronotope/chrono/issues/1333))
- Do complete range checks in `Parsed::set_*`
([#​1465](https://redirect.github.com/chronotope/chrono/issues/1465))
### Documentation
- Rustfmt doctests
([#​1452](https://redirect.github.com/chronotope/chrono/issues/1452))
- Improve docs for crate features
([#​1455](https://redirect.github.com/chronotope/chrono/issues/1455),
thanks [@​edmorley](https://redirect.github.com/edmorley))
- Add more documentation and examples to `Parsed`
([#​1439](https://redirect.github.com/chronotope/chrono/issues/1439))
### Internal
- Refactor `internals` module
([#​1428](https://redirect.github.com/chronotope/chrono/issues/1428),
[#​1429](https://redirect.github.com/chronotope/chrono/issues/1429),
[#​1431](https://redirect.github.com/chronotope/chrono/issues/1431),
[#​1432](https://redirect.github.com/chronotope/chrono/issues/1432),
[#​1433](https://redirect.github.com/chronotope/chrono/issues/1433),
[#​1438](https://redirect.github.com/chronotope/chrono/issues/1438))
- CI: test cross-compiling to `x86_64-unknown-illumos` instead of
Solaris
([#​1437](https://redirect.github.com/chronotope/chrono/issues/1437))
- CI: lint Windows target, fix clippy warning
([#​1441](https://redirect.github.com/chronotope/chrono/issues/1441))
- CI: only run `cargo hack check` on Linux
([#​1442](https://redirect.github.com/chronotope/chrono/issues/1442))
- Update windows-bindgen to 0.54
([#​1462](https://redirect.github.com/chronotope/chrono/issues/1462),
[#​1483](https://redirect.github.com/chronotope/chrono/issues/1483))
- Simplify error value of `parse_internal`
([#​1459](https://redirect.github.com/chronotope/chrono/issues/1459))
- Simplify `SerdeError`
([#​1458](https://redirect.github.com/chronotope/chrono/issues/1458))
- Simplify `NaiveDate::from_isoywd` a bit
([#​1464](https://redirect.github.com/chronotope/chrono/issues/1464))
Thanks to all contributors on behalf of the chrono team,
[@​djc](https://redirect.github.com/djc) and
[@​pitdicker](https://redirect.github.com/pitdicker)!
###
[`v0.4.34`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.34)
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.33...v0.4.34)
### Notable changes
- In chrono 0.4.34 we finished the work to make all methods const where
doing so is supported by rust 1.61.
- We renamed the `Duration` type to `TimeDelta`. This removes the
confusion between chrono's type and the later `Duration` type in the
standard library. It will remain available under the old name as a type
alias for compatibility.
- The Windows implementation of `Local` is rewritten. The new version
avoids panics when the date is outside of the range supported by windows
(the years 1601 to 30828), and gives more accurate results during DST
transitions.
- The `Display` format of `TimeDelta` is modified to conform better to
ISO 8601. Previously it converted all values greater than 24 hours to a
value with days. This is not correct, as doing so changes the duration
from an 'accurate' to a 'nominal' representation to use ISO 8601 terms.
### Fixes
- Add missing range check in `TimeDelta::milliseconds`
([#​1385](https://redirect.github.com/chronotope/chrono/issues/1385),
thanks [@​danwilliams](https://redirect.github.com/danwilliams))
- Remove check for `DurationExceedsTimestamp` in `DurationRound`
([#​1403](https://redirect.github.com/chronotope/chrono/issues/1403),
thanks [@​joroKr21](https://redirect.github.com/joroKr21))
- Fix localized formatting with `%X`
([chronotope/pure-rust-locales#12](https://redirect.github.com/chronotope/pure-rust-locales/pull/12),
[#​1420](https://redirect.github.com/chronotope/chrono/issues/1420))
- Windows: base implementation on `GetTimeZoneInformationForYear`
([#​1017](https://redirect.github.com/chronotope/chrono/issues/1017))
### Additions
- Add `TimeDelta::try_milliseconds`
([#​1385](https://redirect.github.com/chronotope/chrono/issues/1385),
thanks [@​danwilliams](https://redirect.github.com/danwilliams))
- Add `TimeDelta::new`
([#​1337](https://redirect.github.com/chronotope/chrono/issues/1337))
- Add `StrftimeItems::{parse, parse_to_owned}` and more documentation
([#​1184](https://redirect.github.com/chronotope/chrono/issues/1184))
- More standard traits and documentation for `format::Locale` (via
[chronotope/pure-rust-locales#8](https://redirect.github.com/chronotope/pure-rust-locales/pull/8))
### Changes
- Rename `Duration` to `TimeDelta`, add type alias
([#​1406](https://redirect.github.com/chronotope/chrono/issues/1406))
- Make `TimeDelta` methods const
([#​1337](https://redirect.github.com/chronotope/chrono/issues/1337))
- Make remaining methods of `NaiveDate`, `NaiveWeek`, `NaiveTime` and
`NaiveDateTime` const where possible
([#​1337](https://redirect.github.com/chronotope/chrono/issues/1337))
- Make methods on `DateTime` const where possible
([#​1400](https://redirect.github.com/chronotope/chrono/issues/1400))
- Make `Display` format of `TimeDelta` conform better to ISO 8601
([#​1328](https://redirect.github.com/chronotope/chrono/issues/1328))
### Documentation
- Fix the formatting of `timestamp_micros`'s Example doc
([#​1338](https://redirect.github.com/chronotope/chrono/issues/1338)
via
[#​1386](https://redirect.github.com/chronotope/chrono/issues/1386),
thanks [@​emikitas](https://redirect.github.com/emikitas))
- Specify branch for GitHub Actions badge and fix link
([#​1388](https://redirect.github.com/chronotope/chrono/issues/1388))
- Don't mention some deprecated methods in docs
([#​1395](https://redirect.github.com/chronotope/chrono/issues/1395))
- Remove stray documentation from main
([#​1397](https://redirect.github.com/chronotope/chrono/issues/1397))
- Improved documentation of `TimeDelta` constructors
([#​1385](https://redirect.github.com/chronotope/chrono/issues/1385),
thanks [@​danwilliams](https://redirect.github.com/danwilliams))
### Internal
- Switch branch names: 0.4.x releases are the `main` branch, work on 0.5
happens in the `0.5.x` branch
([#​1390](https://redirect.github.com/chronotope/chrono/issues/1390),
[#​1402](https://redirect.github.com/chronotope/chrono/issues/1402)).
- Don't use deprecated method in `impl Arbitrary for DateTime` and set
up CI test
([#​1336](https://redirect.github.com/chronotope/chrono/issues/1336))
- Remove workaround for Rust < 1.61
([#​1393](https://redirect.github.com/chronotope/chrono/issues/1393))
- Bump `codecov/codecov-action` from 3 to 4
([#​1404](https://redirect.github.com/chronotope/chrono/issues/1404))
- Remove partial support for handling `-0000` offset
([#​1411](https://redirect.github.com/chronotope/chrono/issues/1411))
- Move `TOO_LONG` error out of `parse_internal`
([#​1419](https://redirect.github.com/chronotope/chrono/issues/1419))
Thanks to all contributors on behalf of the chrono team,
[@​djc](https://redirect.github.com/djc) and
[@​pitdicker](https://redirect.github.com/pitdicker)!
###
[`v0.4.33`](https://redirect.github.com/chronotope/chrono/releases/tag/v0.4.33)
[Compare
Source](https://redirect.github.com/chronotope/chrono/compare/v0.4.32...v0.4.33)
This release fixes the broken docrs.rs build of [chrono
0.4.32](https://redirect.github.
</details>
---
### Configuration
📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/oxc-project/schemars).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xNi4xIiwidXBkYXRlZEluVmVyIjoiNDIuNDIuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Boshen <boshenc@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
copy_non_overlappinginstead ofswapto reduce memory writes, like what we've done in #44355 andString::retain.#48065 already tried to do this optimization but it is reverted in #67300 due to bad codegen of
DrainFilter::drop.This PR re-implement the drop-then-move approach. I did a benchmark on small-no-drop, small-need-drop, large-no-drop elements with different predicate functions. It turns out that the new implementation is >20% faster in average for almost all cases. Only 2/24 cases are slower by 3% and 5%. See the link above for more detail.
I think regression in may-panic cases is due to drop-guard preventing some optimization. If it's permitted to leak elements when predicate function of element's
droppanic, the new implementation should be almost always faster than current one.I'm not sure if we should leak on panic, since there is indeed an issue (#52267) complains about it before.