Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

streamDelimiter

Public Function
std.Io.Reader.streamDelimiter
pub fn streamDelimiter(r: *Reader, w: *Writer, delimiter: u8) StreamError!usize

Appends to w contents by reading from the stream until delimiter is found. Does not write the delimiter itself.

Does not discard the delimiter from the Reader.

Returns number of bytes streamed, which may be zero, or error.EndOfStream if the delimiter was not found.

Asserts buffer capacity of at least one. This function performs better with larger buffers.

See also:

Params

Errors

ReadFailed

See the Reader implementation for detailed diagnostics.

WriteFailed

See the Writer implementation for detailed diagnostics.

EndOfStream

End of stream indicated from the Reader. This error cannot originate from the Writer.

File

Io/Reader.zig:956
956
957
958
959
960
961
962
963
pub fn streamDelimiter(r: *Reader, w: *Writer, delimiter: u8) StreamError!usize {
    const n = streamDelimiterLimit(r, w, delimiter, .unlimited) catch |err| switch (err) {
        error.StreamTooLong => unreachable, // unlimited is passed
        else => |e| return e,
    };
    if (r.seek == r.end) return error.EndOfStream;
    return n;
}