'Hello World' plugin example

This commit is contained in:
Fabian Schmidt 2024-01-12 15:29:32 +01:00
commit 3c801ed649
4 changed files with 2728 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

2704
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

9
Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[package]
name = "app"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
extism = "1.0.0"

14
src/main.rs Normal file
View File

@ -0,0 +1,14 @@
use extism::*;
fn main() {
let url =
Wasm::url("https://github.com/extism/plugins/releases/latest/download/count_vowels.wasm");
let manifest = Manifest::new([url]);
let mut plugin = Plugin::new(&manifest, [], true).unwrap();
let res = plugin
.call::<&str, &str>("count_vowels", "Hello, world!")
.unwrap();
println!("{}", res);
}