Function toArrayListAligned [src]

Returns an array list that takes ownership of the allocated memory. Resets the Allocating to an empty state.

Prototype

pub fn toArrayListAligned( a: *Allocating, comptime alignment: std.mem.Alignment, ) std.array_list.Aligned(u8, alignment)

Parameters

a: *Allocatingalignment: std.mem.Alignment

Source

pub fn toArrayListAligned( a: *Allocating, comptime alignment: std.mem.Alignment, ) std.array_list.Aligned(u8, alignment) { assert(a.alignment == alignment); // Required for Allocator correctness. const w = &a.writer; const result: std.array_list.Aligned(u8, alignment) = .{ .items = @alignCast(w.buffer[0..w.end]), .capacity = w.buffer.len, }; w.buffer = &.{}; w.end = 0; return result; }