Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

discardRemaining

Consumes the stream until the end, ignoring all the data, returning the number of bytes discarded.

Reader.discardRemaining
pub fn discardRemaining(r: *Reader) ShortError!usize

File

lib/std/Io/Reader.zig:274

Code

pub fn discardRemaining(r: *Reader) ShortError!usize {
    var offset: usize = r.end - r.seek;
    r.seek = r.end;
    while (true) {
        offset += r.vtable.discard(r, .unlimited) catch |err| switch (err) {
            error.EndOfStream => return offset,
            else => |e| return e,
        };
    }
}