Skip to main content

non_zero_alloc

Function non_zero_alloc 

Source
pub unsafe fn non_zero_alloc(layout: Layout) -> *mut u8
Expand description

std::alloc::alloc that accepts zero-sized layouts.

A zero-sized layout is bumped to one byte, because the standard allocator refuses zero-sized allocations. Intuicio stores zero-sized types often.

ยงSafety

Same as std::alloc::alloc. The returned pointer must be freed with non_zero_dealloc using the same layout.