-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Allow setting the limit on std::io::Take. #42697
Conversation
r? @sfackler (rust_highfive has picked a reviewer for you, use r? to override) |
Arguably this can also be not implemented since out-of-tree implementation should involve no more than |
This seems reasonable to me - might be worth explicitly mentioning that it doesn't "reset" the count of what's been read? @rfcbot fcp merge |
I'll fix the code if we decide to move forward with this, hopefully landing after #42612. |
Team member @sfackler has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, 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. |
ccf4c94
to
64f6561
Compare
64f6561
to
547e1c6
Compare
ping @brson, still waiting for your checkbox here! |
src/libstd/io/mod.rs
Outdated
@@ -1761,6 +1761,35 @@ impl<T> Take<T> { | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
pub fn limit(&self) -> u64 { self.limit } | |||
|
|||
/// Sets the number of bytes that can be read before this instance will | |||
/// return EOF. This is the same as constructing a new `Take` instance, so | |||
/// the amount of bytes read or the previous limit value do not affect the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"do not affect the effect" is a somewhat confusing phrasing. Also missing period.
Left a nit, otherwise r=me |
547e1c6
to
7109d03
Compare
Fixed the nit (I think). @brson hasn't checked off yet, so I'm hesitant to r+ without that. |
@bors: r+ @Mark-Simulacrum for PRs (rather than RFCs), after a week if most folks have signed off we go forward. |
📌 Commit 7109d03 has been approved by |
Allow setting the limit on std::io::Take. Fixes #27269.
☀️ Test successful - status-appveyor, status-travis |
Fixes #27269.