mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
std.Io.Reader: remove aggressive assert from fill
with `.fixed("")` you should still be able to do `fill(1)` and have it
return error.EndOfStream.
This commit is contained in:
parent
a0d1682921
commit
a288266f33
1 changed files with 2 additions and 2 deletions
|
|
@ -990,9 +990,9 @@ pub fn discardDelimiterLimit(r: *Reader, delimiter: u8, limit: Limit) DiscardDel
|
||||||
/// Returns `error.EndOfStream` if and only if there are fewer than `n` bytes
|
/// Returns `error.EndOfStream` if and only if there are fewer than `n` bytes
|
||||||
/// remaining.
|
/// remaining.
|
||||||
///
|
///
|
||||||
/// Asserts buffer capacity is at least `n`.
|
/// If the end of stream is not encountered, asserts buffer capacity is at
|
||||||
|
/// least `n`.
|
||||||
pub fn fill(r: *Reader, n: usize) Error!void {
|
pub fn fill(r: *Reader, n: usize) Error!void {
|
||||||
assert(n <= r.buffer.len);
|
|
||||||
if (r.seek + n <= r.end) {
|
if (r.seek + n <= r.end) {
|
||||||
@branchHint(.likely);
|
@branchHint(.likely);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue