diff --git a/src/containers/table.zig b/src/containers/table.zig index 1affd83..6e514cb 100644 --- a/src/containers/table.zig +++ b/src/containers/table.zig @@ -138,7 +138,7 @@ pub fn Table(comptime K: type, comptime V: type) type { } /// Remove the item from the table. This will panic if the item does not exist in the table. - /// to check first, use tryRemove instead. + /// to check first, use removeOrNull instead. pub fn remove(self: *Self, id: Id) !V { assert(self.len > 0); try self.free_list.push(id.index); @@ -158,7 +158,7 @@ pub fn Table(comptime K: type, comptime V: type) type { } /// Attempt to remove an item from the table, returning null if it does not exist. - pub fn tryRemove(self: *Self, id: Id) !?V { + pub fn removeOrNull(self: *Self, id: Id) !?V { return if (self.exists(id)) self.remove(id) else null; } @@ -344,8 +344,8 @@ pub fn RefTable(comptime K: type, comptime V: type) type { return self.table.size(); } - pub fn tryRemove(self: *Self, id: Id) !?V { - if (self.table.tryRemove(id)) |v| { + pub fn removeOrNull(self: *Self, id: Id) !?V { + if (self.table.removeOrNull(id)) |v| { self.ref_counts.items[id.index] = 0; return v; } @@ -354,7 +354,7 @@ pub fn RefTable(comptime K: type, comptime V: type) type { } /// Remove an item from the table. This panics if the item is not already present. - /// use tryRemove to verify the item is present. + /// use removeOrNull to verify the item is present. pub fn remove(self: *Self, id: Id) !V { self.ref_counts.items[id.index] = 0; return self.table.remove(id);