Function create [src]
Returns a pointer to undefined memory.
Call destroy with the result to free the memory.
Prototype
pub fn create(a: Allocator, comptime T: type) Error!*T
Parameters
a: Allocator
T: type
Possible Errors
Source
pub fn create(a: Allocator, comptime T: type) Error!*T {
if (@sizeOf(T) == 0) return @as(*T, @ptrFromInt(math.maxInt(usize)));
const ptr: *T = @ptrCast(try a.allocBytesWithAlignment(@alignOf(T), @sizeOf(T), @returnAddress()));
return ptr;
}