Struct InitializingSlice

pub(in ::clone::uninit) struct InitializingSlice<'a, T> { pub(in ::clone::uninit) data: &'a mut [MaybeUninit<T>], pub(in ::clone::uninit) initialized_len: usize }

Ownership of a collection of values stored in a non-owned [MaybeUninit<T>], some of which are not yet initialized. This is sort of like a Vec that doesn't own its allocation. Its responsibility is to provide cleanup on unwind by dropping the values that are initialized, unless disarmed by forgetting.

This is a helper for impl<T: Clone> CloneToUninit for [T].

Fields

data: &'a mut [MaybeUninit<T>]
initialized_len: usize

Number of elements of *self.data that are initialized.

Implementations

impl<'a, T> InitializingSlice<'a, T>

fn from_fully_uninit(data: &'a mut [MaybeUninit<T>]) -> Self
fn push(&mut self, value: T)

Push a value onto the end of the initialized part of the slice.

Panics

Panics if the slice is already fully initialized.

Trait Implementations

impl<'a, T> Drop for InitializingSlice<'a, T>

fn drop(&mut self)

Auto Trait Implementations

impl<'a, T> !UnwindSafe for InitializingSlice<'a, T>

impl<'a, T> Freeze for InitializingSlice<'a, T> where &'a mut [MaybeUninit<T>]: Freeze,

impl<'a, T> RefUnwindSafe for InitializingSlice<'a, T> where &'a mut [MaybeUninit<T>]: RefUnwindSafe,

impl<'a, T> Send for InitializingSlice<'a, T> where &'a mut [MaybeUninit<T>]: Send,

impl<'a, T> Sync for InitializingSlice<'a, T> where &'a mut [MaybeUninit<T>]: Sync,

impl<'a, T> Unpin for InitializingSlice<'a, T> where &'a mut [MaybeUninit<T>]: Unpin,

impl<'a, T> UnsafeUnpin for InitializingSlice<'a, T> where &'a mut [MaybeUninit<T>]: UnsafeUnpin,

Blanket Implementations

impl<T> Any for InitializingSlice<'a, T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for InitializingSlice<'a, T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for InitializingSlice<'a, T> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for InitializingSlice<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for InitializingSlice<'a, T> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for InitializingSlice<'a, T>

impl<T, U> Into<U> for InitializingSlice<'a, T> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for InitializingSlice<'a, T> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for InitializingSlice<'a, T> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>