-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsValue
module conversions
#2771
Conversation
2336392
to
0e1ccad
Compare
This version includes `JsValue` conversions for `Module` that include type hints.
0e1ccad
to
24410a8
Compare
24410a8
to
06e81fc
Compare
impl<T: Send + Sync> Post for T {} | ||
|
||
#[cfg(web)] | ||
const _: () = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A module should just work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A module does also work but it's not quite as nice (have to import super::*
and think up a meaningless name). This is a bit of an idiom.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I find this syntax a bit sad compared to mod trait_impls
or something but if the rest of the team can decide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vote on this was split so I'm going to take the approval and merge — we can reconsider later :)
@@ -214,6 +213,66 @@ impl UserServiceModule for WasmServiceModule { | |||
} | |||
} | |||
|
|||
#[cfg(web)] | |||
const _: () = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
We actually can't remove this `Send` and `Sync` until we can send the `ExecutionStateRequest`s via `postMessage`, i.e. issue linera-io#2552. That issue is far enough divorced from this code that I don't want to link it here, so let's just remove the TODO.
Motivation
We want to send cached (precompiled) modules between threads. In the JavaScript case, that means we need to be able to convert the modules into a
JsValue
that is suitable to be sent viapostMessage
.Proposal
JsValue
for Wasmer modules (including the type hints and other metadata)wasm::Module
typelinera-execution
trait objects using a boxed trait object akin todyn-clone
Test Plan
CI for type-correctness, and the actual conversion behaviour has been tested through
linera-web
.Release Plan
Links