pub trait HostFunctions: Send + Sync {
// Required methods
fn log<'life0, 'life1, 'async_trait>(
&'life0 self,
level: LogLevel,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_config<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<Option<WasmValue>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_config<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: WasmValue,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 str,
payload: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args: WasmValue,
) -> Pin<Box<dyn Future<Output = WasmResult<WasmValue>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn storage_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn storage_set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn storage_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn now_ms<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WasmResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn random_bytes<'life0, 'async_trait>(
&'life0 self,
len: u32,
) -> Pin<Box<dyn Future<Output = WasmResult<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn sleep_ms<'life0, 'async_trait>(
&'life0 self,
ms: u64,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn call_custom<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Vec<WasmValue>,
) -> Pin<Box<dyn Future<Output = WasmResult<WasmValue>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Host functions interface that plugins can call
Required Methods§
Sourcefn log<'life0, 'life1, 'async_trait>(
&'life0 self,
level: LogLevel,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn log<'life0, 'life1, 'async_trait>(
&'life0 self,
level: LogLevel,
message: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Log a message
Sourcefn get_config<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<Option<WasmValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_config<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<Option<WasmValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get configuration value
Sourcefn set_config<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: WasmValue,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_config<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: WasmValue,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set configuration value (requires WriteConfig capability)
Sourcefn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 str,
payload: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 str,
payload: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send a message to another agent/plugin
Sourcefn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args: WasmValue,
) -> Pin<Box<dyn Future<Output = WasmResult<WasmValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call_tool<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_name: &'life1 str,
args: WasmValue,
) -> Pin<Box<dyn Future<Output = WasmResult<WasmValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Call a tool
Sourcefn storage_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn storage_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get from storage
Sourcefn storage_set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn storage_set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Set in storage
Sourcefn storage_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn storage_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = WasmResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete from storage
Sourcefn now_ms<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WasmResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn now_ms<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = WasmResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get current timestamp (milliseconds)
Sourcefn random_bytes<'life0, 'async_trait>(
&'life0 self,
len: u32,
) -> Pin<Box<dyn Future<Output = WasmResult<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn random_bytes<'life0, 'async_trait>(
&'life0 self,
len: u32,
) -> Pin<Box<dyn Future<Output = WasmResult<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate random bytes