Function appendRemainingUnlimited [src]

Prototype

pub fn appendRemainingUnlimited(r: *Reader, gpa: Allocator, list: *ArrayList(u8)) UnlimitedAllocError!void

Parameters

r: *Readergpa: Allocatorlist: *ArrayList(u8)

Possible Errors

OutOfMemory Error
ReadFailed ShortError

See the Reader implementation for detailed diagnostics.

Source

pub fn appendRemainingUnlimited(r: *Reader, gpa: Allocator, list: *ArrayList(u8)) UnlimitedAllocError!void { var a: std.Io.Writer.Allocating = .initOwnedSlice(gpa, list.allocatedSlice()); a.writer.end = list.items.len; list.* = .empty; defer { list.* = .{ .items = a.writer.buffer[0..a.writer.end], .capacity = a.writer.buffer.len, }; } _ = streamRemaining(r, &a.writer) catch |err| switch (err) { error.WriteFailed => return error.OutOfMemory, error.ReadFailed => return error.ReadFailed, }; }