pub fn insertBounded(self: *Self, index: usize, elem: T) error self: *Selfindex: usizeelem: T379
380
381
382 pub fn insertBounded(self: *Self, index: usize, elem: T) error{OutOfMemory}!void {
if (self.capacity - self.len < 1) return error.OutOfMemory;
return insertAssumeCapacity(self, index, elem);
}
Inserts an item into the list. Shifts all elements after and including the specified index back by one and sets the given index to the specified element.
If capacity is not sufficient to hold an additional item, returns
error.OutOfMemory.