-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
io: remove Poll
from the AsyncSeek::start_seek
return value
#2885
io: remove Poll
from the AsyncSeek::start_seek
return value
#2885
Conversation
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
Thanks for getting this going 👍 Looking at this, i'm wondering it would make more sense to do something like: trait AsyncSeek {
fn start_seek(self: Pin<&mut Self>, position: SeekFrom) -> io::Result<()>;
fn poll_complete(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>>;
}
What do you think? |
It's a bit dangerous because you have to handle e.g. two seeks of |
@carllerche @Darksonn Just so I am sure I get this correct. Would that mean that |
@Darksonn @zaharidichev How about we split the difference. In practice, this limits the trait to 1 in-flight seek, but I think that is OK. |
I think that's good. |
tokio/src/fs/file.rs
Outdated
loop { | ||
match self.state { | ||
Busy(_) => panic!("must wait for poll_ready before calling start_seek"), |
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 think this panic message is out of date?
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.
LGTM thanks 👍 I believe there is an out of date panic message.
Motivation
To remove the Poll from
start_seek
and rely onpoll_ready
insteadFix: #1994
Signed-off-by: Zahari Dichev zaharidichev@gmail.com