[][src]Struct sc_executor_common::sandbox::SandboxInstance

pub struct SandboxInstance<FR> { /* fields omitted */ }

Sandboxed instance of a wasm module.

It's primary purpose is to invoke exported functions on it.

All imports of this instance are specified at the creation time and imports are implemented by the supervisor.

Hence, in order to invoke an exported function on a sandboxed module instance, it's required to provide supervisor externals: it will be used to execute code in the supervisor context.

This is generic over a supervisor function reference type.

Methods

impl<FR> SandboxInstance<FR>[src]

pub fn invoke<FE: SandboxCapabilities<SupervisorFuncRef = FR>>(
    &self,
    export_name: &str,
    args: &[RuntimeValue],
    supervisor_externals: &mut FE,
    state: u32
) -> Result<Option<RuntimeValue>, Error>
[src]

Invoke an exported function by a name.

supervisor_externals is required to execute the implementations of the syscalls that published to a sandboxed module instance.

The state parameter can be used to provide custom data for these syscall implementations.

pub fn get_global_val(&self, name: &str) -> Option<Value>[src]

Get the value from a global with the given name.

Returns Some(_) if the global could be found.

Auto Trait Implementations

impl<FR> !RefUnwindSafe for SandboxInstance<FR>

impl<FR> !Send for SandboxInstance<FR>

impl<FR> !Sync for SandboxInstance<FR>

impl<FR> Unpin for SandboxInstance<FR> where
    FR: Unpin

impl<FR> !UnwindSafe for SandboxInstance<FR>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,