First example of a wasm plugin with wasmer

This commit is contained in:
Fabian Schmidt
2024-01-12 20:08:44 +01:00
commit f75de7e6b7
8 changed files with 1475 additions and 0 deletions

View 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"]

View 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);
}
}