Struct wasm3::Module [−][src]
pub struct Module<'rt> { /* fields omitted */ }
Expand description
A loaded module belonging to a specific runtime. Allows for linking and looking up functions.
Implementations
pub fn parse<TData: Into<Box<[u8]>>>(
environment: &Environment,
bytes: TData
) -> Result<ParsedModule>
pub fn parse<TData: Into<Box<[u8]>>>(
environment: &Environment,
bytes: TData
) -> Result<ParsedModule>
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
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
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