Enum lunatic::WasmModule
source · [−]pub enum WasmModule {
Module(u64),
Inherit,
}
Expand description
A compiled instance of a WebAssembly module.
Creating a module will also JIT compile it, this can be a compute intensive tasks.
Variants
Module(u64)
Inherit
Implementations
sourceimpl WasmModule
impl WasmModule
sourcepub fn new(data: &[u8]) -> Result<Self, LunaticError>
pub fn new(data: &[u8]) -> Result<Self, LunaticError>
Compiles a WebAssembly module.
Once a module is compiled, functions like spawn
can be used to spawn new
processes from it.
sourcepub fn id(&self) -> i64
pub fn id(&self) -> i64
Returns the id of the module resource or -1 in case it’s an inherited module.
sourcepub fn spawn<M, S>(
&self,
function: &str,
params: &[Param]
) -> Result<Process<M, S>, LunaticError> where
S: Serializer<M>,
pub fn spawn<M, S>(
&self,
function: &str,
params: &[Param]
) -> Result<Process<M, S>, LunaticError> where
S: Serializer<M>,
Spawn a new process and use function
as the entry point. If the function takes arguments
the passed in params
need to exactly match their types.
sourcepub fn spawn_link<M, S>(
&self,
function: &str,
params: &[Param]
) -> Result<Process<M, S>, LunaticError> where
S: Serializer<M>,
pub fn spawn_link<M, S>(
&self,
function: &str,
params: &[Param]
) -> Result<Process<M, S>, LunaticError> where
S: Serializer<M>,
Spawn a new process and link it to the current one.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for WasmModule
impl Send for WasmModule
impl Sync for WasmModule
impl Unpin for WasmModule
impl UnwindSafe for WasmModule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more