pub struct WasmExecutor { /* private fields */ }Implementations§
Source§impl WasmExecutor
impl WasmExecutor
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Build an executor from raw .wasm bytes.
Sourcepub fn list_exports(&self) -> Vec<String>
pub fn list_exports(&self) -> Vec<String>
Enumerate exported function names.
Sourcepub fn call_json(&self, method: &str, input: &Value) -> Result<Value>
pub fn call_json(&self, method: &str, input: &Value) -> Result<Value>
Call a WASM guest method with JSON input and receive JSON output.
The guest must export three symbols:
alloc(size: i32) -> i32— allocatesizebytes, return pointerfree(ptr: i32, size: i32)— free a previous allocationoxide_invoke(method_ptr: i32, method_len: i32, input_ptr: i32, input_len: i32) -> i64— dispatch; thei64return packs outputptr(high 32 bits) andlen(low 32 bits).
§Errors
Returns KernelError::Other if any WASM call fails, memory is out of
bounds, or the output bytes are not valid UTF-8 / JSON.
Auto Trait Implementations§
impl !Freeze for WasmExecutor
impl !RefUnwindSafe for WasmExecutor
impl Send for WasmExecutor
impl Sync for WasmExecutor
impl Unpin for WasmExecutor
impl UnsafeUnpin for WasmExecutor
impl !UnwindSafe for WasmExecutor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more