std.fifo: make toOwnedSlice support head != 0

This commit is contained in:
Andrew Kelley 2023-03-12 00:25:00 -07:00
parent fbce6a749d
commit 53fb59ea9b

View File

@ -385,6 +385,7 @@ pub fn LinearFifo(
}
pub fn toOwnedSlice(self: *Self) Allocator.Error![]T {
if (self.head != 0) self.realign();
assert(self.head == 0);
assert(self.count <= self.buf.len);
const allocator = self.allocator;