feat: extism

This commit is contained in:
2022-12-04 14:40:25 +08:00
parent 78db54db6c
commit 78561aec5b
5 changed files with 2497 additions and 1 deletions

2486
__wasm/extism/extism_container/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -6,3 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
extism = "0.1.0"

View File

@@ -0,0 +1,3 @@
> https://extism.org/docs/integrate-into-your-codebase/rust-host-sdk

Binary file not shown.

View File

@@ -1,3 +1,9 @@
use extism::{Context, Plugin};
fn main() { fn main() {
println!("Hello, world!"); let wasm = include_bytes!("../code.wasm");
let context = Context::new();
let mut plugin = Plugin::new(&context, wasm, false).unwrap();
let data = plugin.call("count_vowels", "this is a test").unwrap();
assert_eq!(data, b"{\"count\": 4}");
} }