[][src]Struct wasm3::Module

pub struct Module<'rt> { /* fields omitted */ }

A loaded module belonging to a specific runtime. Allows for linking and looking up functions.

Implementations

impl<'rt> Module<'rt>[src]

pub fn parse(environment: &Environment, bytes: &[u8]) -> Result<ParsedModule>[src]

Parses a wasm module from raw bytes.

Links the given function to the corresponding module and function name. This allows linking a more verbose function, as it gets access to the unsafe runtime parts. For easier use the make_func_wrapper should be used to create the unsafe facade for your function that then can be passed to this.

For a simple API see link_closure which takes a closure instead.

Errors

This function will return an error in the following situations:

  • a memory allocation failed
  • no function by the given name in the given module could be found
  • the function has been found but the signature did not match

Links the given closure to the corresponding module and function name. This boxes the closure and therefor requires a heap allocation.

Errors

This function will return an error in the following situations:

  • a memory allocation failed
  • no function by the given name in the given module could be found
  • the function has been found but the signature did not match

pub fn find_function<Args, Ret>(
    &self,
    function_name: &str
) -> Result<Function<'rt, Args, Ret>> where
    Args: WasmArgs,
    Ret: WasmType
[src]

Looks up a function by the given name in this module.

Errors

This function will return an error in the following situations:

  • a memory allocation failed
  • no function by the given name in the given module could be found
  • the function has been found but the signature did not match

pub fn function<Args, Ret>(
    &self,
    function_index: usize
) -> Result<Function<'rt, Args, Ret>> where
    Args: WasmArgs,
    Ret: WasmType
[src]

Looks up a function by its index in this module.

Errors

This function will return an error in the following situations:

  • a memory allocation failed
  • the index is out of bounds
  • the function has been found but the signature did not match

pub fn name(&self) -> &str[src]

The name of this module.

Links wasi to this module.

Links libc to this module.

Auto Trait Implementations

impl<'rt> !RefUnwindSafe for Module<'rt>

impl<'rt> !Send for Module<'rt>

impl<'rt> !Sync for Module<'rt>

impl<'rt> Unpin for Module<'rt>

impl<'rt> !UnwindSafe for Module<'rt>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.