-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update wasm::Module to enable wasm component model [try 2] (#123)
* add HermesEventPayload trait, update wasm Module * refactor * refactor * update test * update * add docs * update * fix spelling * update * refactor Context * refactor * update wasm::module * fix formating * commented out test * move event mod under the event_queue mod * move bindings mod to the separate file * move Context and Statefull to another module * update error handling * fix docs * update errors
- Loading branch information
Showing
41 changed files
with
645 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//! Hermes event definition | ||
|
||
use crate::wasm::module::ModuleInstance; | ||
|
||
/// A trait for defining the behavior of a Hermes event. | ||
pub trait HermesEventPayload { | ||
/// Returns the name of the event associated with the payload. | ||
fn event_name(&self) -> &str; | ||
|
||
/// Executes the behavior associated with the payload, using the provided executor. | ||
/// | ||
/// # Arguments | ||
/// | ||
/// * `executor` - The executor to use for executing the payload's behavior. | ||
/// | ||
/// # Returns | ||
/// | ||
/// An `anyhow::Result` indicating the success or failure of the payload execution. | ||
fn execute(&self, executor: &mut ModuleInstance) -> anyhow::Result<()>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//! Hermes event queue implementation. | ||
|
||
pub(crate) mod event; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
//! Intentionally empty | ||
//! This file exists, so that doc tests can be used inside binary crates. | ||
|
||
mod event_queue; | ||
mod runtime; | ||
mod state; | ||
mod wasm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
//! The Hermes Node. | ||
|
||
mod event_queue; | ||
mod runtime; | ||
mod state; | ||
mod wasm; | ||
|
||
fn main() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//! Hermes `wasmtime::component::bindgen` generated code | ||
//! | ||
//! *Note* | ||
//! Inspect the generated code with: | ||
//! `cargo expand --bin hermes runtime::extensions::bindings` | ||
|
||
#![allow(clippy::indexing_slicing)] | ||
|
||
use wasmtime::component::bindgen; | ||
|
||
bindgen!({ | ||
world: "hermes", | ||
path: "../../wasm/wasi/wit", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.