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.

peekSentinel

Returns a slice of the next bytes of buffered data from the stream until sentinel is found, without advancing the seek position.

Returned slice has a sentinel; end of stream does not count as a delimiter.

Invalidates previously returned values from peek.

See also:

Reader.peekSentinel
pub fn peekSentinel(r: *Reader, comptime sentinel: u8) DelimiterError![:sentinel]u8

File

lib/std/Io/Reader.zig:790

Code

pub fn peekSentinel(r: *Reader, comptime sentinel: u8) DelimiterError![:sentinel]u8 {
    const result = try r.peekDelimiterInclusive(sentinel);
    return result[0 .. result.len - 1 :sentinel];
}