pub fn allocate<T, A>(value: T, alloc: &A) -> Result<NonNull<T>, AllocError>where
A: Allocator,
Expand description
Moves value
to the memory backed by alloc
and returns a pointer.
This should be similar to Box::into_raw(Box::try_new_in(value, alloc)?)
, except without
alloc
requirement and intermediate steps.
ยงNote
The resulting pointer has no owner. The caller is responsible for destroying T
and releasing
the memory.