Function sc_executor_common::sandbox::instantiate [−][src]
pub fn instantiate<'a, FE: SandboxCapabilities>(
supervisor_externals: &mut FE,
dispatch_thunk: FE::SupervisorFuncRef,
wasm: &[u8],
host_env: GuestEnvironment,
state: u32
) -> Result<UnregisteredInstance<FE::SupervisorFuncRef>, InstantiationError>
Instantiate a guest module and return it’s index in the store.
The guest module’s code is specified in wasm
. Environment that will be available to
guest module is specified in raw_env_def
(serialized version of EnvironmentDefinition
).
dispatch_thunk
is used as function that handle calls from guests.
Errors
Returns Err
if any of the following conditions happens:
raw_env_def
can’t be deserialized as aEnvironmentDefinition
.- Module in
wasm
is invalid or couldn’t be instantiated.