| ... | ... | @@ -28,14 +28,14 @@ pub fn BoundedArray(comptime T: type, comptime capacity: usize) type { |
| 28 | 28 | return Self{ .len = len }; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | | /// View the internal array as a mutable slice whose size was previously set. |
| 32 | | pub fn slice(self: *Self) []T { |
| 31 | /// View the internal array as a slice whose size was previously set. |
| 32 | pub fn slice(self: anytype) mem.Span(@TypeOf(&self.buffer)) { |
| 33 | 33 | return self.buffer[0..self.len]; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /// View the internal array as a constant slice whose size was previously set. |
| 37 | 37 | pub fn constSlice(self: *const Self) []const T { |
| 38 | | return self.buffer[0..self.len]; |
| 38 | return self.slice(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /// Adjust the slice's length to `len`. |