`LocalShared` similar to `futures_util`'s `Shared`
JsValue isn't Send/Sync since https://github.com/wasm-bindgen/wasm-bindgen/pull/955 . This prevents the use of OnceCell-like things and futures_util's Shared. I may hack up my own in the meantime, but would it make sense to have a similar LocalShared that can't be sent across threads?
I was trying to figure out the best place to ask about this:
-
wasm-bindgenhas good reasons for making JsValue non sync/send, so probably not there - I was going to post in
futures_util, but - it felt like
LocalSharedwould parallelspawn_localwhich is here (edit: wasm-bindgen-futures) and not in tokio/futures
Edit: Oops, I thought wasm_bindgen_futures was a different repo and didn't notice.
https://github.com/wasm-bindgen/wasm-bindgen/pull/4770 adds back Send and Sync support for JsValue with that configuration. Would that resolve your use case here?
Oh yeah!
I'm working in the browser, where IIUC there may be multi-threaded environments at some point, so I think this may be riskier than having local-wrappers? But it'd work for me...