Open
Description
Feature gate: #![feature(atomic_from_mut)]
Public API
impl AtomicU32 {
pub fn from_mut(v: &mut u32) -> &mut Self;
pub fn from_mut_slice(v: &mut [u32]) -> &mut [Self];
pub fn get_mut_slice(this: &mut [Self]) -> &mut [u32];
}
// And same for AtomicBool, AtomicU8, AtomicU16, AtomicU64, AtomicI8, AtomicI16, AtomicI32, AtomicI64, and AtomicPtr
Each one is gated on #[cfg(target_has_atomic_equal_alignment = "..")]
and is only available on platforms where Atomic<size>
has the same alignment as u<size>
.
Steps / History
- Implementation: Add Atomic*::from_mut. #74532
- Make
Atomic*::from_mut
return&mut Atomic*
#92671 - Add Atomic*::from_mut_slice #94384
- Add
Atomic*::get_mut_slice
#94816 - Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
Should these return— yes: Make&mut Self
instead, such that it's the exact inverse ofget_mut
?Atomic*::from_mut
return&mut Atomic*
#92671Also add— yes: Add Atomic*::from_mut_slice #94384from_mut_slice
?