wasm-bindgen/examples/webxr/Cargo.toml
Liam Murphy 823f57698c
Deprecate JsValue::from_serde and JsValue::into_serde (#3031)
* 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
2022-08-29 23:17:27 -05:00

64 lines
1.1 KiB
TOML

[package]
name = "webxr"
version = "0.1.0"
authors = ["The wasm-bindgen Developers"]
edition = "2018"
[lib]
crate-type = ["cdylib"]
[dependencies]
futures = "0.3.4"
js-sys = "0.3.59"
wasm-bindgen = "0.2.82"
wasm-bindgen-futures = "0.4.32"
[dependencies.web-sys]
version = "0.3.36"
features = [
'Document',
'Element',
'Gpu',
'Headers',
'HtmlCanvasElement',
'Navigator',
'Request',
'RequestInit',
'RequestMode',
'Response',
'WebGl2RenderingContext',
'Window',
'XrBoundedReferenceSpace',
'XrEye',
'XrFrame',
'XrHandedness',
'XrInputSource',
'XrInputSourceArray',
'XrInputSourceEvent',
'XrInputSourceEventInit',
'XrInputSourcesChangeEvent',
'XrPose',
'XrReferenceSpace',
'XrReferenceSpaceEvent',
'XrReferenceSpaceEventInit',
'XrReferenceSpaceType',
'XrRenderState',
'XrRenderStateInit',
'XrRigidTransform',
'XrSession',
'XrSessionEvent',
'XrSessionEventInit',
'XrSessionInit',
'XrSessionMode',
'XrSpace',
'XrTargetRayMode',
'XrView',
'XrViewerPose',
'XrViewport',
'XrVisibilityState',
'XrWebGlLayer',
'XrWebGlLayerInit',
'XrSystem',
'console'
]