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

js-sys: allow any JsValue to be fallibly converted into a js_sys::Iterator #776

Closed
2 tasks
fitzgen opened this issue Aug 30, 2018 · 1 comment
Closed
2 tasks
Labels
help wanted We could use some help fixing this issue! js-sys Issues related to the `js-sys` crate

Comments

@fitzgen
Copy link
Member

fitzgen commented Aug 30, 2018

It should do something like

let into_iter = Reflect::get(this, Symbol::iterator())?;
into_iter.call0(this)

where this is the js_sys::Object.

TODO:

  • Implement what's described here
  • Add a reference section about how to iterate over JS values to the wasm-bindgen guide
@fitzgen fitzgen added help wanted We could use some help fixing this issue! js-sys Issues related to the `js-sys` crate labels Aug 30, 2018
@fitzgen fitzgen changed the title js-sys: allow any js_sys::Object to be fallibly converted into a js_sys::Iterator js-sys: allow any JsValue to be fallibly converted into a js_sys::Iterator Sep 12, 2018
@fitzgen
Copy link
Member Author

fitzgen commented Sep 12, 2018

To be clear, I'm imagining somethign like a blanket TryFrom impl for js_sys::Iter, but since TryFrom isn't stable, it can be its own generic method or something.

fitzgen added a commit to fitzgen/wasm-bindgen that referenced this issue Sep 25, 2018
fitzgen added a commit to fitzgen/wasm-bindgen that referenced this issue Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We could use some help fixing this issue! js-sys Issues related to the `js-sys` crate
Projects
None yet
Development

No branches or pull requests

1 participant