Trait uninit_tools::traits::Initialize[][src]

pub unsafe trait Initialize {
    type Item;
    fn as_maybe_uninit_slice(&self) -> &[MaybeUninit<Self::Item>]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
unsafe fn as_maybe_uninit_slice_mut(
        &mut self
    ) -> &mut [MaybeUninit<Self::Item>]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
; }

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>]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[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>]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[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.

Loading content...

Implementations on Foreign Types

impl<'a, T> Initialize for &'a mut [MaybeUninit<T>][src]

type Item = T

impl<T> Initialize for Box<[MaybeUninit<T>]>[src]

type Item = T

impl<T, const N: usize> Initialize for [MaybeUninit<T>; N][src]

type Item = T

Loading content...

Implementors

impl<T, Item> Initialize for AsUninit<T> where
    T: Deref<Target = [Item]> + DerefMut + TrustedDeref
[src]

type Item = Item

impl<T: Initialize> Initialize for SingleVector<T>[src]

type Item = <T as Initialize>::Item

Loading content...