Skip to content

std: merge io.PeekStream and io.BufferedInStreamCustom #4505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

daurnimator
Copy link
Contributor

Closes #4501

@daurnimator daurnimator added the standard library This issue involves writing Zig code for the standard library. label Feb 19, 2020
@@ -141,7 +174,7 @@ pub fn BufferedInStreamCustom(comptime buffer_size: usize, comptime Error: type)
// fifo empty, fill it
const writable = self.fifo.writableSlice(0);
assert(writable.len > 0);
const n = try self.unbuffered_in_stream.read(writable);
const n = try self.base.read(writable);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test case to catch the bug here, where it does not leave any reserved buffer space, and putBack would fail here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the issue. Which bug are you referring to?

@andrewrk
Copy link
Member

andrewrk commented Mar 5, 2020

Feel free to open a new one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

provide a peeking API to std.io.BufferedReader
2 participants