Skip to content
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

Specify that Reader::read does not block if data is available. #18106

Closed
mahkoh opened this issue Oct 16, 2014 · 2 comments
Closed

Specify that Reader::read does not block if data is available. #18106

mahkoh opened this issue Oct 16, 2014 · 2 comments

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Oct 16, 2014

The details of this probably depend on the Reader implementation, i.e., what does it mean that data is available.

Some examples:

  • A BufferedReader will not call read on the contained Reader if the buffer is not empty
  • If reading from a file descriptor succeeds but not enough data is returned to fill the buffer, the Reader will not attempt a second read.

If the user wants the whole buffer to be filled (unless we're at EOF), he can use the try_fill method which is being introduced in #18059.

@steveklabnik
Copy link
Member

It would see that this is implementation-specific, yeah. @aturon @alexcrichton is this kind of thing something to specify? /cc #21070

@alexcrichton
Copy link
Member

The current documentation of Read::read states:

This function does not provide any guarantees about whether it blocks waiting for data

The Read trait has become much more general and I believe this issue is moot now.

lnicola pushed a commit to lnicola/rust that referenced this issue Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants