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 create(config: Option<&Config>) -> WasmEdgeResult<Self>
pub fn create(config: Option<&Config>) -> WasmEdgeResult<Self>
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
Available on crate feature ffi
only.
pub fn as_ptr(&self) -> *const WasmEdge_LoaderContext
ffi
only.Provides a raw pointer to the inner Loader context.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Loader
impl Send for Loader
impl Sync for Loader
impl Unpin for Loader
impl UnwindSafe for Loader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more