| ... | ... | @@ -239,12 +239,23 @@ pub fn ArrayHashMap( |
| 239 | 239 | return self.unmanaged.orderedRemove(key); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | | /// Asserts there is an `Entry` with matching key, deletes it from the hash map, |
| 243 | | /// and discards it. |
| 242 | /// TODO: deprecated: call swapRemoveAssertDiscard instead. |
| 244 | 243 | pub fn removeAssertDiscard(self: *Self, key: K) void { |
| 245 | 244 | return self.unmanaged.removeAssertDiscard(key); |
| 246 | 245 | } |
| 247 | 246 | |
| 247 | /// Asserts there is an `Entry` with matching key, deletes it from the hash map |
| 248 | /// by swapping it with the last element, and discards it. |
| 249 | pub fn swapRemoveAssertDiscard(self: *Self, key: K) void { |
| 250 | return self.unmanaged.swapRemoveAssertDiscard(key); |
| 251 | } |
| 252 | |
| 253 | /// Asserts there is an `Entry` with matching key, deletes it from the hash map |
| 254 | /// by by shifting all elements forward thereby maintaining the current ordering. |
| 255 | pub fn orderedRemoveAssertDiscard(self: *Self, key: K) void { |
| 256 | return self.unmanaged.orderedRemoveAssertDiscard(key); |
| 257 | } |
| 258 | |
| 248 | 259 | pub fn items(self: Self) []Entry { |
| 249 | 260 | return self.unmanaged.items(); |
| 250 | 261 | } |
| ... | ... | @@ -602,12 +613,23 @@ pub fn ArrayHashMapUnmanaged( |
| 602 | 613 | return self.removeInternal(key, .ordered); |
| 603 | 614 | } |
| 604 | 615 | |
| 605 | | /// Asserts there is an `Entry` with matching key, deletes it from the hash map, |
| 606 | | /// and discards it. |
| 616 | /// TODO deprecated: call swapRemoveAssertDiscard instead. |
| 607 | 617 | pub fn removeAssertDiscard(self: *Self, key: K) void { |
| 618 | return self.swapRemoveAssertDiscard(key); |
| 619 | } |
| 620 | |
| 621 | /// Asserts there is an `Entry` with matching key, deletes it from the hash map |
| 622 | /// by swapping it with the last element, and discards it. |
| 623 | pub fn swapRemoveAssertDiscard(self: *Self, key: K) void { |
| 608 | 624 | assert(self.swapRemove(key) != null); |
| 609 | 625 | } |
| 610 | 626 | |
| 627 | /// Asserts there is an `Entry` with matching key, deletes it from the hash map |
| 628 | /// by by shifting all elements forward thereby maintaining the current ordering. |
| 629 | pub fn orderedRemoveAssertDiscard(self: *Self, key: K) void { |
| 630 | assert(self.orderedRemove(key) != null); |
| 631 | } |
| 632 | |
| 611 | 633 | pub fn items(self: Self) []Entry { |
| 612 | 634 | return self.entries.items; |
| 613 | 635 | } |