pub struct WasmImports {
pub pd_send: Box<dyn Fn(*const u8, u32, *const u8, u32) -> i32 + Send + Sync + 'static>,
pub pd_now_micros: Box<dyn Fn() -> u64 + Send + Sync + 'static>,
pub pd_log: Box<dyn Fn(i32, *const u8, u32) + Send + Sync + 'static>,
}Expand description
Host function callbacks injected into a WASM module at instantiation.
These correspond to the pd_* imports that a plugin WASM module may call.
The closures receive raw pointers into a buffer that was read from WASM
linear memory immediately before the call; the pointers are valid for the
duration of the call only.
The + Send + Sync + 'static bounds are required because wasmtime host
functions must be thread-safe. Use Default to obtain no-op stubs.
Fields§
§pd_send: Box<dyn Fn(*const u8, u32, *const u8, u32) -> i32 + Send + Sync + 'static>Send a message to another actor.
Arguments: (envelope_ptr, envelope_len, payload_ptr, payload_len).
Returns 0 on success, negative on error.
pd_now_micros: Box<dyn Fn() -> u64 + Send + Sync + 'static>Return the current engine time in microseconds.
pd_log: Box<dyn Fn(i32, *const u8, u32) + Send + Sync + 'static>Emit a log message.
Arguments: (level, msg_ptr, msg_len).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WasmImports
impl !RefUnwindSafe for WasmImports
impl Send for WasmImports
impl Sync for WasmImports
impl Unpin for WasmImports
impl UnsafeUnpin for WasmImports
impl !UnwindSafe for WasmImports
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more