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

Async iterator streams wip #271

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build]
rustflags = ["--cfg=web_sys_unstable_apis"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? Is this unstable on the Rust side or JS side? Are there browser implications? Does this work on all browsers that support Wasm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unstable on the rust side - it's required for use of the web_sys::ReadableStreamDefaultController (ReadableStream itself doesn't require it). It looks like the controller class isn't globally defined on browsers older than ~Feb 2020 (~7% in most jurisdictions), but calling new ReadableStream({start, pull, cancel}) works as far back as at least Chrome 57 (Firefox 52-65 and Edge 16-18 appear to be the only versions where WebAssembly support was available before ReadableStream constructors). Eyeballing the caniuse figures, its about 0.1% of browsers with !ReadableStream && Webassembly.

I was a little leery of the potential for the Rust side method names to change, but it looks like the web-sys codegen for optional arguments (<original_method_name>with) is pretty stable.


[target.wasm32-unknown-unknown]
rustflags = ["--cfg=web_sys_unstable_apis"]
Loading