Attribute Macro extism_pdk::shared_fn
source · #[shared_fn]
Expand description
shared_fn
is used to define a function that will be exported by a plugin but is not directly
callable by an Extism runtime. These functions can be used for runtime linking and mocking host
functions for tests. If direct access to Wasm native parameters is needed, then a bare
extern "C" fn
should be used instead.
All arguments should implement extism_pdk::ToBytes
and the return value should implement
extism_pdk::FromBytes
§Example
use extism_pdk::{FnResult, shared_fn};
#[shared_fn]
pub fn greet2(greeting: String, name: String) -> FnResult<String> {
let s = format!("{greeting}, {name}");
Ok(name)
}