* Add `JsCast` to `wasm_bindgen::prelude`
`JsCast` is a very commonly used trait, but for some reason has never been added to `wasm_bindgen::prelude`, leading to the constant annoyance of having to manually import it.
* Remove redundant imports
* Deprecate `JsValue::from_serde` and `JsValue::into_serde`
I've listed `serde-wasm-bindgen` as the replacement, and changed the section of the guide that talks about Serde to talk about `serde-wasm-bindgen` instead of the deprecated methods.
I didn't remove it entirely because I can imagine someone remembering it and trying to look it back up, only to find that it no longer exists, which would quite frustrating. I also added a footnote about the deprecated methods in case someone remembers the old way and wants to know what happened.
There were several examples using `from_serde`/`into_serde`, which I updated to use `serde-wasm-bindgen` or not use `serde` altogether.
The `fetch` example was a bit weird, in that it took a JS value, parsed it into a Rust value, only to serialize it back into a JS value. I removed that entirely in favour of just passing the original JS value directly. I suppose it behaves slightly differently in that it loses the extra validation, but a panic isn't all that much better than a JS runtime error.
* fmt
* Mention JSON as an alternative to `serde-wasm-bindgen`
* Use `gloo-utils` instead of raw `JSON`
I was considering leaving the examples using `JSON` directly and mentioning `gloo-utils` as an aside, but that has the major footgun that `JSON.stringify(undefined) === undefined`, causing a panic when deserializing `undefined` since the return type of `JSON::stringify` isn't optional. `gloo-utils` works around this, so I recommended it instead.
* Mention `gloo-utils` in API docs
* Rephrase section about deprecated methods
There isn't much of a reason to use `Closure::wrap` over `Closure::new` anymore, so this changes `wasm-bindgen`'s examples to use `Closure::new` as the recommended method of creating closures.
* Upgraded the webpack examples' npm dependencies which (among other things) upgrades them to webpack 5
For the weather_report, had to choose the syncWebAssembly experiment,
whereas the rest works fine with asyncWebAssembly
* Fix the weather report example compilation by adding it to the main workspace.
This currently fails with:
error: current package believes it's in a workspace when it's not:
current:
<project-root>/examples/weather_report/Cargo.toml
workspace: <project-root>/Cargo.toml
* Fix the build of the webxr example with webpack 5
* run cargo fmt