Struct wasmedge_sys::Loader

source ·
pub struct Loader { /* private fields */ }
Expand description

Loader is used to load WASM modules from the given WASM files or buffers.

Implementations§

Create a new Loader to be associated with the given global configuration.

Arguments
  • config - A global configuration.
Error

If fail to create a Loader, then an error is returned.

Loads a WASM module from a WASM file.

Arguments
  • file - A wasm file or an AOT wasm file.
Error

If fail to load, then an error is returned.

Example
let file = "path/to/foo.wasm"
let module = loader.from_file(file)?;

Loads a WASM module from a in-memory bytes.

Arguments
  • bytes - A in-memory WASM bytes.
Error

If fail to load, then an error is returned.

Example
let bytes = b"\0asm\x01\0\0\0";
let module = loader.from_bytes(&bytes)?;

Note that the text format is not accepted:

assert!(loader.from_bytes(b"(module)").is_err());

Provides a raw pointer to the inner Loader context.

Trait Implementations§

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.