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