| ... | @@ -780,6 +780,14 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ | ... | @@ -780,6 +780,14 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ |
| 780 | pub fn allocatedSlice(self: Self) Slice { | 780 | pub fn allocatedSlice(self: Self) Slice { |
| 781 | return self.items.ptr[0..self.capacity]; | 781 | return self.items.ptr[0..self.capacity]; |
| 782 | } | 782 | } |
| | 783 | |
| | 784 | /// Returns a slice of only the extra capacity after items. |
| | 785 | /// This can be useful for writing directly into an ArrayList. |
| | 786 | /// Note that such an operation must be followed up with a direct |
| | 787 | /// modification of `self.items.len`. |
| | 788 | pub fn unusedCapacitySlice(self: Self) Slice { |
| | 789 | return self.allocatedSlice()[self.items.len..]; |
| | 790 | } |
| 783 | }; | 791 | }; |
| 784 | } | 792 | } |
| 785 | | 793 | |