Skip to main content

Module owning_slice

Module owning_slice 

Source
Expand description

Functions to produce an OwningSlice<'_, T>, a.k.a. a Vec<T, NoopAllocator<'_>>, from mutably borrowed MaybeUninit<T>s.

Note that there are no functions which take &mut ManuallyDrop here, even as unsafe fns, since Vec may use it’s spare capacity in ways that violate ManuallyDrop<T>’s validity invariants, not just it’s safety invariants.

Functions§

empty_from_maybeuninit
Create a OwningSlice<'a, T> with a length of 0 and a capacity of 1 from a &'a mut MaybeUninit<T>>.
empty_from_maybeuninit_slice
Create a OwningSlice<'a, T> with a length of 0 from a &'a mut [MaybeUninit<T>]>. The capacity is the length of the given slice.
empty_from_raw
Create an empty OwningSlice<'a, T> from a raw slice pointer. The capacity is the length of the given slice.
from_maybeuninit
Create a OwningSlice<'a, T> with a length and capacity of 1 from a &'a mut MaybeUninit<T>>.
from_maybeuninit_slice
Create a OwningSlice<'a, T> with a given length from a &'a mut [MaybeUninit<T>]>. The capacity is the length of the given slice.
from_raw
Create a OwningSlice<'a, T> with a given length from a raw slice pointer. The capacity is the length of the given slice.
full_from_raw
Create a full OwningSlice<'a, T> from a raw slice pointer.
new
Create an empty OwningSlice<'a, T> with a length and capacity of 0.

Type Aliases§

OwningSlice
An owning slice reference boorrowing a memory location but owning the value in it, implemented as Vec<T, NoopAllocator<'a>>.