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<Arc<Module>>
pub fn from_bytes(&self, bytes: impl AsRef<[u8]>) -> WasmEdgeResult<Arc<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());
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Loader
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