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

expose register_reader and register_writer so that manual futures can be implemented #36

Closed
dvc94ch opened this issue Oct 7, 2020 · 3 comments

Comments

@dvc94ch
Copy link
Contributor

dvc94ch commented Oct 7, 2020

since rust doesn't support self referential structs there needs to be an alternative to async fn next(&self). Since self isn't owned there is no way to get it into a struct so that it can be polled.

@ghost
Copy link

ghost commented Oct 7, 2020

How about this API, would that work for you?

impl<T> Async<T> {
    fn poll_readable(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>>;
    fn poll_writable(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>>;
}

Note sure about &mut self vs self: Pin<&mut Self> though...

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Oct 7, 2020

yes, that would work, as it registers a waker. the problem is that at the moment there is no way to get a manual future implementation to wake up.

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Nov 20, 2020

Closed by #38

@dvc94ch dvc94ch closed this as completed Nov 20, 2020
notgull added a commit that referenced this issue May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant