The caller owns the returned memory. Capacity is cleared, making deinit() safe but unnecessary to call.
pub fn toOwnedSlice(self: *ArrayListReverse) Error![]u8
pub fn toOwnedSlice(self: *ArrayListReverse) Error![]u8 {
const new_memory = try self.allocator.alloc(u8, self.data.len);
@memcpy(new_memory, self.data);
@memset(self.data, undefined);
self.clearAndFree();
return new_memory;
}