pub fn peek(r: *Reader, n: usize) Error![]u8
Returns the next n bytes from the stream, filling the buffer as necessary.
n
Invalidates previously returned values from peek.
peek
Asserts that the Reader was initialized with a buffer capacity at least as big as n.
Reader
If there are fewer than n bytes left in the stream, error.EndOfStream is returned instead.
error.EndOfStream
See also:
toss
r: *Reader
n: usize
ReadFailed
See the Reader implementation for detailed diagnostics.
EndOfStream
515 516 517 518
pub fn peek(r: *Reader, n: usize) Error![]u8 { try r.fill(n); return r.buffer[r.seek..][0..n]; }
Returns the next
nbytes from the stream, filling the buffer as necessary.Invalidates previously returned values from
peek.Asserts that the
Readerwas initialized with a buffer capacity at least as big asn.If there are fewer than
nbytes left in the stream,error.EndOfStreamis returned instead.See also:
toss