-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
BufReader/Writer extension methods: is_empty, buffer #45323
Comments
Implement is_empty() for BufReader Simple implementation of `is_empty` method for BufReader so it is possible to tell whether there is any data in its buffer. I didn't know correct stability annotation to place on the function. Presumably there is no reason to place this feature behind a feature flag, but I wasn't sure how to tag it as an unstable feature without that. CC: #45323
What's left for this to stabilize? I'm parsing bytes from a |
This is the tracking issue for: impl<R: Read> BufReader<R> {
pub fn is_empty(&self) -> bool { /*…*/ }
} Looks good to me to stabilize. @rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This seems fine to stabilize, but it seems like it'd be more useful to know how many bytes are buffered, rather than just that there are some number of bytes. |
Why not both? Slices have |
For sure. Would it be reasonable to try to squeeze that into this stabilization? |
Sounds ok to me, though we should probably (re)start FCP after the implementation is merged. |
Naming wise, I don't think |
Agreed. Sounds good to me. |
Alternatively, we could add |
#49139 adds |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
With @sfackler's alternative (and IMO better) proposal just introduced, should this still be going into its final comment period? |
@rfcbot fcp cancel Let’s start again after |
@SimonSapin proposal cancelled. |
We should likely also add a |
That can't be done backwards compatibly. |
@sfackler why not? It's just a |
It has been a while since |
|
Wait, we aren't proposing to stabilize the (already deprecated) is_empty method are we? |
No, sorry I didn’t clarify. An API marked both unstable and deprecated is to be removed (after something like a couple release cycles of deprecation period, which we’re at in this case). |
I'm excited to see that this is so close to landing. Is this still waiting on an implementation of |
…ster Add BufWriter::buffer method CC rust-lang#45323
…ster Add BufWriter::buffer method CC rust-lang#45323
Bump. Is there anything else blocking stabilization? |
Is there any particular reason not to add |
Yeah, this has been a while. @SimonSapin @sfackler is this ready for a vote to stabilize? |
This issue seems to have been stuck in a strange limbo state for quite a while now. Pinging more people the rfcbot mentioned... @alexcrichton @aturon @dtolnay @withoutboats |
Sorry we dropped the ball here. This is now one method on the impl<R> BufReader<R> {
pub fn buffer(&self) -> &[u8] {…}
}
impl<W: Write> BufWriter<W> {
pub fn buffer(&self) -> &[u8] {…}
} @rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@edef1c There is nothing called |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@SimonSapin Sorry, yes, I meant |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
…r=Centril Stabilize bufreader_buffer feature FCP done in rust-lang#45323 (comment) Closes rust-lang#45323 r? @SimonSapin
…r=Centril Stabilize bufreader_buffer feature FCP done in rust-lang#45323 (comment) Closes rust-lang#45323 r? @SimonSapin
Update: this is the tracking issue for:
is_empty
is both unstable and deprecated, it should be removed.There is currently no way to tell whether there is any data buffered inside a BufReader. This is unfortunate because it means that an application has no way to know whether calls to read() and fill_buffer() will return instantly or trigger a potentially expensive call to the underlying Reader. I propose adding an is_empty() method to BufReader to fill this gap.
The text was updated successfully, but these errors were encountered: