| ... | @@ -1152,14 +1152,14 @@ pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type { | ... | @@ -1152,14 +1152,14 @@ pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type { |
| 1152 | | 1152 | |
| 1153 | /// Shrinks capacity to match length. | 1153 | /// Shrinks capacity to match length. |
| 1154 | /// May invalidate element pointers. | 1154 | /// May invalidate element pointers. |
| 1155 | /// If succeds it is safe to call toOwnedSliceAssert(). | 1155 | /// If succeds it is safe to call `toOwnedSliceAssert`. |
| 1156 | pub fn shrinkToLen(self: *Self, gpa: Allocator) Allocator.Error!void { | 1156 | pub fn shrinkToLen(self: *Self, gpa: Allocator) Allocator.Error!void { |
| 1157 | try self.shrinkAndFreePrecise(gpa, self.items.len); | 1157 | try self.shrinkAndFreePrecise(gpa, self.items.len); |
| 1158 | } | 1158 | } |
| 1159 | | 1159 | |
| 1160 | /// Shrinks or expands capacity to match length + 1. | 1160 | /// Shrinks or expands capacity to match length + 1. |
| 1161 | /// May invalidate element pointers. | 1161 | /// May invalidate element pointers. |
| 1162 | /// If succeds it is safe to call toOwnedSliceSentinelAssert(). | 1162 | /// If succeds it is safe to call `toOwnedSliceSentinelAssert`. |
| 1163 | pub fn shrinkToLenSentinel(self: *Self, gpa: Allocator) Allocator.Error!void { | 1163 | pub fn shrinkToLenSentinel(self: *Self, gpa: Allocator) Allocator.Error!void { |
| 1164 | std.debug.assert(self.items.len <= self.capacity); | 1164 | std.debug.assert(self.items.len <= self.capacity); |
| 1165 | const required_len = self.items.len + 1; | 1165 | const required_len = self.items.len + 1; |