extism_runtime/
lib.rs

1pub use anyhow::Error;
2pub(crate) use wasmtime::*;
3
4mod context;
5mod function;
6mod internal;
7pub mod manifest;
8pub(crate) mod pdk;
9mod plugin;
10mod plugin_ref;
11pub mod sdk;
12mod timer;
13
14pub use context::Context;
15pub use function::{Function, UserData, Val, ValType};
16pub use internal::{Internal, InternalExt, Wasi};
17pub use manifest::Manifest;
18pub use plugin::Plugin;
19pub use plugin_ref::PluginRef;
20pub(crate) use timer::{Timer, TimerAction};
21
22pub type Size = u64;
23pub type PluginIndex = i32;
24
25pub(crate) use log::{debug, error, trace};
26
27/// Converts any type implementing `std::fmt::Debug` into a suitable CString to use
28/// as an error message
29pub(crate) fn error_string(e: impl std::fmt::Debug) -> std::ffi::CString {
30    let x = format!("{:?}", e).into_bytes();
31    let x = if x[0] == b'"' && x[x.len() - 1] == b'"' {
32        x[1..x.len() - 1].to_vec()
33    } else {
34        x
35    };
36    unsafe { std::ffi::CString::from_vec_unchecked(x) }
37}