Function fill [src]

Fills the buffer such that it contains at least n bytes, without advancing the seek position. Returns error.EndOfStream if and only if there are fewer than n bytes remaining. If the end of stream is not encountered, asserts buffer capacity is at least n.

Prototype

pub fn fill(r: *Reader, n: usize) Error!void

Parameters

r: *Readern: usize

Possible Errors

EndOfStream
ReadFailed

See the Reader implementation for detailed diagnostics.

Example

test fill { var r: Reader = .fixed("abc"); try r.fill(1); try r.fill(3); }

Source

pub fn fill(r: *Reader, n: usize) Error!void { if (r.seek + n <= r.end) { @branchHint(.likely); return; } return fillUnbuffered(r, n); }