shrinkRetainingCapacity
Shrinks the underlying Entry array to new_len elements and
discards any associated index entries. Keeps capacity the same.
Asserts the discarded entries remain initialized and capable of performing hash and equality checks. Any deinitialization of discarded entries must take place after calling this function.
Function parameters
Parameters
- self:*Self
- new_len:usize
Type definitions in this namespace
Types
An `ArrayHashMap` with default hash and equal functions.
Functions
- AutoArrayHashMap
- An `ArrayHashMap` with default hash and equal functions.
- AutoArrayHashMapUnmanaged
- An `ArrayHashMapUnmanaged` with default hash and equal functions.
- StringArrayHashMap
- An `ArrayHashMap` with strings as keys.
- StringArrayHashMapUnmanaged
- An `ArrayHashMapUnmanaged` with strings as keys.
- ArrayHashMap
- Deprecated in favor of `ArrayHashMapWithAllocator` (no code changes needed)
- ArrayHashMapWithAllocator
- A hash table of keys and values, each stored sequentially.
- ArrayHashMapUnmanaged
- A hash table of keys and values, each stored sequentially.
Source
Implementation
pub fn shrinkRetainingCapacity(self: *Self, new_len: usize) void {
if (@sizeOf(ByIndexContext) != 0)
@compileError("Cannot infer context " ++ @typeName(Context) ++ ", call shrinkRetainingCapacityContext instead.");
return self.shrinkRetainingCapacityContext(new_len, undefined);
}