pub struct Linker<UserData = (), UserError = Infallible> { /* private fields */ }
Implementations§
Source§impl<UserData, UserError> Linker<UserData, UserError>
impl<UserData, UserError> Linker<UserData, UserError>
pub fn new() -> Self
Sourcepub fn define_fallback(
&mut self,
func: impl Fn(Caller<'_, UserData>, u32) -> Result<(), UserError> + Send + Sync + 'static,
)
pub fn define_fallback( &mut self, func: impl Fn(Caller<'_, UserData>, u32) -> Result<(), UserError> + Send + Sync + 'static, )
Defines a fallback external call handler, in case no other registered functions match.
Sourcepub fn define_untyped(
&mut self,
symbol: impl AsRef<[u8]>,
func: impl Fn(Caller<'_, UserData>) -> Result<(), UserError> + Send + Sync + 'static,
) -> Result<&mut Self, Error>where
UserData: 'static,
pub fn define_untyped(
&mut self,
symbol: impl AsRef<[u8]>,
func: impl Fn(Caller<'_, UserData>) -> Result<(), UserError> + Send + Sync + 'static,
) -> Result<&mut Self, Error>where
UserData: 'static,
Defines a new untyped handler for external calls with a given symbol.
Sourcepub fn define_typed<Params, Args>(
&mut self,
symbol: impl AsRef<[u8]>,
func: impl IntoCallFn<UserData, UserError, Params, Args>,
) -> Result<&mut Self, Error>
pub fn define_typed<Params, Args>( &mut self, symbol: impl AsRef<[u8]>, func: impl IntoCallFn<UserData, UserError, Params, Args>, ) -> Result<&mut Self, Error>
Defines a new statically typed handler for external calls with a given symbol.
Sourcepub fn instantiate_pre(
&self,
module: &Module,
) -> Result<InstancePre<UserData, UserError>, Error>
pub fn instantiate_pre( &self, module: &Module, ) -> Result<InstancePre<UserData, UserError>, Error>
Pre-instantiates a new module, resolving its imports and exports.
Trait Implementations§
Auto Trait Implementations§
impl<UserData, UserError> Freeze for Linker<UserData, UserError>
impl<UserData = (), UserError = Infallible> !RefUnwindSafe for Linker<UserData, UserError>
impl<UserData, UserError> Send for Linker<UserData, UserError>
impl<UserData, UserError> Sync for Linker<UserData, UserError>
impl<UserData, UserError> Unpin for Linker<UserData, UserError>
impl<UserData = (), UserError = Infallible> !UnwindSafe for Linker<UserData, UserError>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more