pub fn alloc_slice_dst_in<S: ?Sized + SliceDst, F>(
container: F,
len: usize,
) -> NonNull<S>
Expand description
Allocate a slice-based DST with the global allocator within some container.
The returned pointer is owned and completely uninitialized; you are required to initialize it correctly.
Note that while this function returns a ptr::NonNull<S>
,
the pointer is to the allocation as specified by container(S::layout(len))
,
so if you want/need a pointer to S
, you will need to offset it.
If the layout to be allocated has zero size, then an arbitrary aligned dangling nonnull pointer is returned.