pub struct LinkerBuilder<State, T> { /* private fields */ }Linker or Instance::new insteadExpand description
A linker used to define module imports and instantiate module instances.
Create this type via the Linker::build method.
Implementationsยง
Sourceยงimpl<T> LinkerBuilder<Ready, T>
impl<T> LinkerBuilder<Ready, T>
Sourceยงimpl<T> LinkerBuilder<Constructing, T>
impl<T> LinkerBuilder<Constructing, T>
Sourcepub fn finish(self) -> LinkerBuilder<Ready, T>
pub fn finish(self) -> LinkerBuilder<Ready, T>
Signals that the LinkerBuilder is now ready to create new Linker instances.
Sourcepub fn func_new(
&mut self,
module: &str,
name: &str,
ty: FuncType,
func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<(), Error> + Send + Sync + 'static,
) -> Result<&mut Self, LinkerError>
pub fn func_new( &mut self, module: &str, name: &str, ty: FuncType, func: impl Fn(Caller<'_, T>, &[Val], &mut [Val]) -> Result<(), Error> + Send + Sync + 'static, ) -> Result<&mut Self, LinkerError>
Creates a new named Func::new-style host Func for this Linker.
For more information see Linker::func_wrap.
ยงErrors
If there already is a definition under the same name for this Linker.
ยงPanics
If the LinkerBuilder has already created a Linker using LinkerBuilder::finish.
Sourcepub fn func_wrap<Params, Args>(
&mut self,
module: &str,
name: &str,
func: impl IntoFunc<T, Params, Args>,
) -> Result<&mut Self, LinkerError>
pub fn func_wrap<Params, Args>( &mut self, module: &str, name: &str, func: impl IntoFunc<T, Params, Args>, ) -> Result<&mut Self, LinkerError>
Creates a new named Func::new-style host Func for this Linker.
For information how to use this API see Func::wrap.
This method creates a host function for this Linker under the given name.
It is distinct in its ability to create a Store independent
host function. Host functions defined this way can be used to instantiate
instances in multiple different Store entities.
The same applies to other Linker methods to define new Func instances
such as Linker::func_new.
In a concurrently running program, this means that these host functions
could be called concurrently if different Store entities are executing on
different threads.
ยงErrors
If there already is a definition under the same name for this Linker.
ยงPanics
If the LinkerBuilder has already created a Linker using LinkerBuilder::finish.