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.

discardDelimiterInclusive

Reads from the stream until specified byte is found, discarding all data, including the delimiter.

Returns number of bytes discarded, or error.EndOfStream if the delimiter is not found.

See also:

Reader.discardDelimiterInclusive
pub fn discardDelimiterInclusive(r: *Reader, delimiter: u8) Error!usize

File

lib/std/Io/Reader.zig:1041

Code

pub fn discardDelimiterInclusive(r: *Reader, delimiter: u8) Error!usize {
    const n = discardDelimiterLimit(r, delimiter, .unlimited) catch |err| switch (err) {
        error.StreamTooLong => unreachable, // unlimited is passed
        else => |e| return e,
    };
    if (r.seek == r.end) return error.EndOfStream;
    assert(r.buffer[r.seek] == delimiter);
    toss(r, 1);
    return n + 1;
}