First example of a wasm plugin with wasmer
This commit is contained in:
12
crates/example-plugin/Cargo.toml
Normal file
12
crates/example-plugin/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "example-plugin"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
15
crates/example-plugin/src/lib.rs
Normal file
15
crates/example-plugin/src/lib.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
#[no_mangle]
|
||||
pub fn add(one: i32, two: i32) -> i32 {
|
||||
one + two
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user