Skip to content

add an example to explain std::io::Read::read returning 0 in some cases #85288

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 23, 2021

Conversation

Geal
Copy link
Contributor

@Geal Geal commented May 14, 2021

I have always found the explanation about Read::read returning 0 to indicate EOF but not indefinitely, so here's more info using Linux as example. I can also add example code if necessary

@rust-highfive
Copy link
Contributor

r? @dtolnay

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2021
@rust-log-analyzer

This comment has been minimized.

the example focuses on Linux, but that should be enough to explain how
the behaviour can change
@Geal Geal force-pushed the clarify-std-io-read branch from 5989f5a to 95ccdb1 Compare May 14, 2021 16:06
@jsha
Copy link
Contributor

jsha commented May 14, 2021

Thanks for adding this comment. FWIW, I found it informative: I learned something I didn't know about files, and also I understand the reason for the "intermittent 0" behavior better.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thank you!

@dtolnay
Copy link
Member

dtolnay commented May 22, 2021

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 22, 2021

📌 Commit 95ccdb1 has been approved by dtolnay

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 22, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2021
Rollup of 6 pull requests

Successful merges:

 - rust-lang#84758 (MSVC: Avoid using jmp stubs for dll function imports)
 - rust-lang#85288 (add an example to explain std::io::Read::read returning 0 in some cases)
 - rust-lang#85334 (Add doc aliases to `unit`)
 - rust-lang#85525 (Fix my mailmap entry)
 - rust-lang#85571 (Remove surplus prepend LinkedList fn)
 - rust-lang#85575 (Fix auto-hide for implementations and implementors.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b1e0d5f into rust-lang:master May 23, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 23, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants