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§
source§impl Loader
impl Loader
sourcepub fn from_bytes(&self, bytes: impl AsRef<[u8]>) -> WasmEdgeResult<Module>
pub fn from_bytes(&self, bytes: impl AsRef<[u8]>) -> WasmEdgeResult<Module>
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());
sourcepub fn as_ptr(&self) -> *const WasmEdge_LoaderContext
pub fn as_ptr(&self) -> *const WasmEdge_LoaderContext
Provides a raw pointer to the inner Loader context.