pub trait SandboxContext {
    fn invoke(
        &mut self,
        invoke_args_ptr: Pointer<u8>,
        invoke_args_len: u32,
        state: u32,
        func_idx: SupervisorFuncIndex
    ) -> Result<i64, Error>; fn supervisor_context(&mut self) -> &mut dyn FunctionContext; }
Expand description

The sandbox context used to execute sandboxed functions.

Required Methods§

Invoke a function in the supervisor environment.

This first invokes the dispatch thunk function, passing in the function index of the desired function to call and serialized arguments. The thunk calls the desired function with the deserialized arguments, then serializes the result into memory and returns reference. The pointer to and length of the result in linear memory is encoded into an i64, with the upper 32 bits representing the pointer and the lower 32 bits representing the length.

Errors

Returns Err if the dispatch_thunk function has an incorrect signature or traps during execution.

Returns the supervisor context.

Implementors§