Minimum core changes required for compiling Eventwork to WASM and allowing other NetworkProviders to support WASM #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
NetworkProvider
trait to be non-send in Wasm32 contextsRuntime
trait,spawn_local
. This returns a non-send future instead of a send future.spawn_local
, otherwise it calls the samespawn
.run_async
instead of calling runtime.spawn directly whenever it was calling thatRuntime
functions to conditionally returnNone
in wasm context. This is due toTask
becomingFakeTask
in singlethreaded contexts which is not public and doesn't actually do anything in the first place.NetworkError
type,Error
. Needed as a generic error to support converting other foreign errors into some type of returnable error in theNetworkProvider
trait.With the above changes and a new NetworkProvider thats not TCP, the crate can compile and run successfully on WASM.