Transfers exactly n bytes from the reader to the ArrayList.
See also:
appendRemainingpub fn appendExact(
r: *Reader,
gpa: Allocator,
list: *ArrayList(u8),
n: usize,
) AppendExactError!void
pub fn appendExact(
r: *Reader,
gpa: Allocator,
list: *ArrayList(u8),
n: usize,
) AppendExactError!void {
try list.ensureUnusedCapacity(gpa, n);
var a = std.Io.Writer.Allocating.fromArrayList(gpa, list);
defer list.* = a.toArrayList();
streamExact(r, &a.writer, n) catch |err| switch (err) {
error.ReadFailed, error.EndOfStream => |e| return e,
error.WriteFailed => unreachable,
};
}