Open
Description
Feature gate: #![feature(maybe_uninit_fill)]
This is a tracking issue for ACP rust-lang/libs-team#156
Public API
// core::mem
impl<T> MaybeUninit<T> {
pub fn fill<'a>(this: &'a mut [MaybeUninit<T>], value: T) -> &'a mut [T]
where
T: Clone;
pub fn fill_with<'a, F>(this: &'a mut [MaybeUninit<T>], mut f: F) -> &'a mut [T]
where
F: FnMut() -> T;
pub fn fill_from<'a, I>(
this: &'a mut [MaybeUninit<T>],
it: I,
) -> (&'a mut [T], &'a mut [MaybeUninit<T>])
where
I: IntoIterator<Item = T>;
}
Steps / History
- Implementation: Implement
MaybeUninit::fill{,_cloned,_mut,_with,_from}
#117426, Implement MaybeUninit::fill{,_with,_from} #121280 - Make slice methods inherent:
MaybeUninit
inherent slice methods part 2 #135394 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Naming: these were originally named
fill
,fill_with
, andfill_from
to be consistent consistent withslice::{fill_with,fill_from}
. Since changing to slice-inherent methods, these needed to be renamed to avoid conflict. Should we change to naming that keepsfill
? Amanieu suggestedfill_init
at Add inherent versions of MaybeUninit methods for slices #129259 (comment).