| ... | @@ -18,14 +18,14 @@ const testing = std.testing; | ... | @@ -18,14 +18,14 @@ const testing = std.testing; |
| 18 | pub fn BoundedArray(comptime T: type, comptime capacity: usize) type { | 18 | pub fn BoundedArray(comptime T: type, comptime capacity: usize) type { |
| 19 | return struct { | 19 | return struct { |
| 20 | const Self = @This(); | 20 | const Self = @This(); |
| 21 | buffer: [capacity]T, | 21 | buffer: [capacity]T = undefined, |
| 22 | len: usize = 0, | 22 | len: usize = 0, |
| 23 | | 23 | |
| 24 | /// Set the actual length of the slice. | 24 | /// Set the actual length of the slice. |
| 25 | /// Returns error.Overflow if it exceeds the length of the backing array. | 25 | /// Returns error.Overflow if it exceeds the length of the backing array. |
| 26 | pub fn init(len: usize) !Self { | 26 | pub fn init(len: usize) !Self { |
| 27 | if (len > capacity) return error.Overflow; | 27 | if (len > capacity) return error.Overflow; |
| 28 | return Self{ .buffer = undefined, .len = len }; | 28 | return Self{ .len = len }; |
| 29 | } | 29 | } |
| 30 | | 30 | |
| 31 | /// View the internal array as a mutable slice whose size was previously set. | 31 | /// View the internal array as a mutable slice whose size was previously set. |