Function initCapacity [src]

Prototype

pub fn initCapacity(allocator: Allocator, capacity: usize) error{OutOfMemory}!Allocating

Parameters

allocator: Allocatorcapacity: usize

Possible Errors

OutOfMemory

Source

pub fn initCapacity(allocator: Allocator, capacity: usize) error{OutOfMemory}!Allocating { return .{ .allocator = allocator, .writer = .{ .buffer = if (capacity == 0) &.{} else (allocator.rawAlloc(capacity, .of(u8), @returnAddress()) orelse return error.OutOfMemory)[0..capacity], .vtable = &vtable, }, .alignment = .of(u8), }; }