pub fn clearRetainingCapacity(self: *Self) void self: *Self217
218
219
220
221
222
223
224
225
226
227
228
229 pub fn clearRetainingCapacity(self: *Self) void {
self.pointer_stability.lock();
defer self.pointer_stability.unlock();
self.entries.len = 0;
if (self.index_header) |header| {
switch (header.capacityIndexType()) {
.u8 => @memset(header.indexes(u8), Index(u8).empty),
.u16 => @memset(header.indexes(u16), Index(u16).empty),
.u32 => @memset(header.indexes(u32), Index(u32).empty),
}
}
}
Clears the map but retains the backing allocation for future use.