-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullA-sliceArea: `[T]`Area: `[T]`C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Add a function:
impl<T> MaybeUninit<T> {
pub fn fill_slice<'a>(this: &'a mut [MaybeUninit<T>], src: T) -> &'a mut [T]
where T: Clone,
{ ... }
}
Similarly to slice::fill
, it allows fast write of the same element to the slice.
Similarly to MaybeUninit::write_slice_cloned
, it returns initialized slice without unsafe code.
Metadata
Metadata
Assignees
Labels
A-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullA-sliceArea: `[T]`Area: `[T]`C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.