pub trait SandboxEnvironmentBuilder<State, Memory>: Sized {
fn new() -> Self;
fn add_host_func<N1, N2>(
&mut self,
module: N1,
field: N2,
f: HostFuncType<State>
)
where
N1: Into<Vec<u8>>,
N2: Into<Vec<u8>>;
fn add_memory<N1, N2>(&mut self, module: N1, field: N2, mem: Memory)
where
N1: Into<Vec<u8>>,
N2: Into<Vec<u8>>;
}
Expand description
Struct that can be used for defining an environment for a sandboxed module.
The sandboxed module can access only the entities which were defined and passed to the module at the instantiation time.
Required Methods§
sourcefn add_host_func<N1, N2>(&mut self, module: N1, field: N2, f: HostFuncType<State>)where
N1: Into<Vec<u8>>,
N2: Into<Vec<u8>>,
fn add_host_func<N1, N2>(&mut self, module: N1, field: N2, f: HostFuncType<State>)where
N1: Into<Vec<u8>>,
N2: Into<Vec<u8>>,
Register a host function in this environment definition.
NOTE that there is no constraints on type of this function. An instance
can import function passed here with any signature it wants. It can even import
the same function (i.e. with same module
and field
) several times. It’s up to
the user code to check or constrain the types of signatures.