Function initCapacity [src]
Prototype
pub fn initCapacity(allocator: Allocator, capacity: usize) error{OutOfMemory}!Allocating
Parameters
allocator: Allocator
capacity: usize
Possible Errors
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),
};
}