Trait uninit_tools::traits::Initialize [−][src]
pub unsafe trait Initialize { type Item; fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<Self::Item>]ⓘ; unsafe fn as_maybe_uninit_slice_mut(
&mut self
) -> &mut [MaybeUninit<Self::Item>]ⓘ; }
A trait for mutable initializable slices, that provide access to all the data required for initialization, before the data can be assumed to be fully initialized.
Safety
This trait is unsafe to implement since whatever slices are returned from the casts here, must have the same length and point to the same memory as before. This is to allow safer abstractions to assume that there are has not unexpectedly appeared additional items that must be initialized.
Associated Types
Loading content...Required methods
fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<Self::Item>]ⓘ
[src]
Retrieve an immutable slice pointing to possibly uninitialized memory. This must be
exactly the same slice as the one from as_maybe_uninit_slice_mut
, or the trait
implementation as a whole, gets incorrect.
unsafe fn as_maybe_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<Self::Item>]ⓘ
[src]
Retrieve a mutable slice pointing to possibly uninitialized memory. This must always point to the same slice as with previous invocations.
Safety
The caller must not use the resulting slice to de-initialize the data.
Implementations on Foreign Types
impl<'a, T> Initialize for &'a mut [MaybeUninit<T>]
[src]
impl<'a, T> Initialize for &'a mut [MaybeUninit<T>]
[src]type Item = T
fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<T>]ⓘ
[src]
unsafe fn as_maybe_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>]ⓘ
[src]
impl<T> Initialize for Box<[MaybeUninit<T>]>
[src]
impl<T> Initialize for Box<[MaybeUninit<T>]>
[src]type Item = T
fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<T>]ⓘ
[src]
unsafe fn as_maybe_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>]ⓘ
[src]
impl<T, const N: usize> Initialize for [MaybeUninit<T>; N]
[src]
impl<T, const N: usize> Initialize for [MaybeUninit<T>; N]
[src]type Item = T
fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<T>]ⓘ
[src]
unsafe fn as_maybe_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>]ⓘ
[src]
Implementors
impl<T, Item> Initialize for AsUninit<T> where
T: Deref<Target = [Item]> + DerefMut + TrustedDeref,
[src]
impl<T, Item> Initialize for AsUninit<T> where
T: Deref<Target = [Item]> + DerefMut + TrustedDeref,
[src]type Item = Item
fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<Item>]ⓘ
[src]
unsafe fn as_maybe_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<Item>]ⓘ
[src]
impl<T: Initialize> Initialize for SingleVector<T>
[src]
impl<T: Initialize> Initialize for SingleVector<T>
[src]