Closed matheus23 closed 5 months ago
Currently almost all the Rust WASM infrastructure relies on SendWrapper
because multi-threading in browsers is still not well defined and everything is single-threaded. I do like your proposal but we still need to see in practice how it will affect beetswap and lumina-node. Feel free to send a PR and we will evaluate it at that time.
Feel free to send a PR and we will evaluate it at that time.
Will definitely do this, but only if/after #6 is merged, because #6 slightly changes the way Send bounds are applied (impl Future + Send
vs. async_trait(?Send)
/async_trait
).
With wasm_bindgen, the
JsValue
andJsFuture
types are!Sync
.I've seen that you've been using
SendWrapper
in your implementation so far, but personally would prefer solutions that don't have the potential to panic at runtime.Here's examples for using conditional compilation for
Send
andSync
bounds:noosphere-storage
and theirConditionalSync
traitwnfs-common
(notice the+ CondSend
bound in the return value of the future) and itssend_sync_poly.rs