-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #13127 : kballard/rust/read_at_least, r=alexcrichton
Reader.read_at_least() ensures that at least a given number of bytes have been read. The most common use-case for this is ensuring at least 1 byte has been read. If the reader returns 0 enough times in a row, a new error kind NoProgress will be returned instead of looping infinitely. This change is necessary in order to properly support Readers that repeatedly return 0, either because they're broken, or because they're attempting to do a non-blocking read on some resource that never becomes available. Also add .push() and .push_at_least() methods. push() is like read() but the results are appended to the passed Vec. Remove Reader.fill() and Reader.push_exact() as they end up being thin wrappers around read_at_least() and push_at_least(). [breaking-change]
- Loading branch information
Showing
4 changed files
with
253 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.