| ... | @@ -201,6 +201,11 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type | ... | @@ -201,6 +201,11 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type |
| 201 | self.dynamic_segments = self.allocator.shrink([*]T, self.dynamic_segments, new_cap_shelf_count); | 201 | self.dynamic_segments = self.allocator.shrink([*]T, self.dynamic_segments, new_cap_shelf_count); |
| 202 | } | 202 | } |
| 203 | | 203 | |
| | 204 | pub fn shrink(self: *Self, new_len: usize) void { |
| | 205 | assert(new_len <= self.len); |
| | 206 | self.len = new_len; |
| | 207 | } |
| | 208 | |
| 204 | pub fn uncheckedAt(self: var, index: usize) AtType(@typeOf(self)) { | 209 | pub fn uncheckedAt(self: var, index: usize) AtType(@typeOf(self)) { |
| 205 | if (index < prealloc_item_count) { | 210 | if (index < prealloc_item_count) { |
| 206 | return &self.prealloc_segment[index]; | 211 | return &self.prealloc_segment[index]; |