extism-pdk 1.4.1

Extism Plug-in Development Kit (PDK) for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![no_main]

use extism_pdk::*;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, ToBytes, FromBytes)]
#[encoding(Json)]
struct Output {
    pub count: i32,
}

#[extism_pdk::shared_fn]
pub unsafe fn hello_world(mut input: Output) -> SharedFnResult<Output> {
    info!("Hello, world!");
    input.count *= 10;
    Ok(input)
}