put const_zeroed into the changelog

This commit is contained in:
Lokathor 2024-05-13 10:59:46 -06:00
parent 9319f4858b
commit a41510f303
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,10 @@
# `bytemuck` changelog
## 1.16.0 (UNRELEASED)
* Adds a `const_zeroed` feature (MSRV 1.75) which puts a `zeroed` fn at the crate root.
This is just like the `Zeroable::zeroed` method, but as a `const fn`.
## 1.15.0
This primarily relaxes the bounds on a `From` impl.

View File

@ -514,11 +514,10 @@ pub fn fill_zeroes<T: Zeroable>(slice: &mut [T]) {
}
}
/// Initialize a zeroed `T`.
///
/// Like [`Zeroable::zeroed`], but supports const.
/// Same as [`Zeroable::zeroed`], but as a `const fn` const.
#[cfg(feature = "const_zeroed")]
#[inline]
#[must_use]
pub const fn zeroed<T: Zeroable>() -> T {
unsafe { core::mem::zeroed() }
}