Skip to content

feat: Stream to AsyncIterator #4526

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpopesculian
Copy link

An attempt to implement the second part of #2399. I haven't written tests yet, but I wanted to have one of y'all take a look at it first before I invest more time into it. Of course, there's weirdness here because promises require 'static, but I figured since we're in a non-threaded context anyways it would be okay to just wrap the stream in an RefCell. However this does mean that there's no guarantees on order if you do something like

let iter = async_iterable_from_rust();
let out = Promise.all([iter.next(), iter.next()])

To counteract that, you could probably just create a chain of oneshot channels but I wanted to get your feedback on the RefCell stuff before I did any more work on it.

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

Successfully merging this pull request may close these issues.

1 participant