-
Notifications
You must be signed in to change notification settings - Fork 633
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
Add async BufReader #1573
Add async BufReader #1573
Conversation
use std::{cmp, fmt}; | ||
use super::DEFAULT_BUF_SIZE; | ||
|
||
/// The `BufReader` struct adds buffering to any reader. |
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.
BufReader
vs AsyncBufReader
(I have no strong opinion.)
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.
Given it's a concrete type, and not a trait, I think BufReader
is fine. It's similar to the naming scheme in Romio
, Tokio
, and Runtime
👍
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.
I wonder if AsyncRead
and AsyncWrite
should've been named PollRead
and PollWrite
(because they only have polling read/write methods).
Then we could rename AsyncReadExt
and AsyncWriteExt
to simply Read
and Write
.
I don't see much point in the Async
prefix if literally no other trait or type has it. Also, the Async*
traits with polling methods are not indented to be used by end-users so it feels wrong for them to have simpler names than the *Ext
traits which are used more often.
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.
@stjepang that's an interesting point; perhaps opening a separate issue might be good for a discussion?
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.
@stjepang the Async*
traits are what should be used in bounds so likely used multiple times per file, whereas the *Ext
traits should be imported and then be used via method syntax so only mentioned once per file.
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.
Most relevant issue: #1398
b69b486
to
1278df1
Compare
cc #1519