Function set [src]
Prototype
pub fn set(self: *Self, allocator: Allocator, index: usize, value: u8) !void
Parameters
self: *Self
allocator: Allocator
index: usize
value: u8
Source
pub fn set(self: *Self, allocator: Allocator, index: usize, value: u8) !void {
if (index >= self.memlimit) {
return error.CorruptInput;
}
try self.buf.ensureTotalCapacity(allocator, index + 1);
while (self.buf.items.len < index) {
self.buf.appendAssumeCapacity(0);
}
self.buf.appendAssumeCapacity(value);
}