-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
BufRead::is_eof #40747
BufRead::is_eof #40747
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
Can you elaborate on the benefits of this function? Seems reasonable, but the libs team is having a hard time imagining where you'd want it. |
Suppose you have a function which reads a message from a stream:
And you want to read all the messages from file. If you have
|
@stepancheg why would this want to be a trait method though? The use case there makes sense, but I'm not sure why that means we should add it to the trait. |
I don't understand. Where else should it be added? Usually only buffered readers can tell if EOF is reached. If you think function is not that useful, I'm OK with just closing the PR. |
Implementation-wise, this does differ from similar APIs like |
This was discussed at libs triage recently and the conclusion we reached were:
Would it be possible to perhaps rename this method to a more evocative name of what it's doing? The conclusion was that we do not want to land this as |
@stepancheg thank you for the contribution! There's been a suggestion to rename the method, do you think you'll be able to make that change? |
@stepancheg thank you for the PR but we are going to close this for now since we haven't heard from you in a few weeks. If you have a chance to update this, please feel free to re-open the PR (or ping us if needed). |
Add has_data_left() to BufRead This is a continuation of rust-lang#40747 and also addresses rust-lang#40745. The problem with the previous PR was that it had "eof" in its method name. This PR uses a more descriptive method name, but I'm open to changing it.
Closes #40745