Skip to content

MaybeUninit::fill_slice #91053

Open
Open
@stepancheg

Description

@stepancheg

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

No one assigned

    Labels

    A-raw-pointersArea: raw pointers, MaybeUninit, NonNullA-sliceArea: `[T]`C-feature-requestCategory: 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions