pub struct WasmPlugin {
pub name: String,
pub engine: Engine,
pub module: Module,
}Expand description
Representasi plugin WebAssembly yang telah dikompilasi dan siap di-instansiasi.
Fields§
§name: String§engine: Engine§module: ModuleImplementations§
Source§impl WasmPlugin
impl WasmPlugin
Sourcepub fn from_wat(name: &str, wat: &str) -> Result<WasmPlugin, SandboxError>
pub fn from_wat(name: &str, wat: &str) -> Result<WasmPlugin, SandboxError>
Buat plugin dari WebAssembly Text format (WAT)
Sourcepub fn from_bytes(name: &str, bytes: &[u8]) -> Result<WasmPlugin, SandboxError>
pub fn from_bytes(name: &str, bytes: &[u8]) -> Result<WasmPlugin, SandboxError>
Buat plugin dari biner WebAssembly (.wasm bytes)
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<WasmPlugin, SandboxError>
pub fn from_file(path: impl AsRef<Path>) -> Result<WasmPlugin, SandboxError>
Buat plugin dari file .wasm di disk
Sourcepub fn instantiate(&self) -> Result<WasmInstance, SandboxError>
pub fn instantiate(&self) -> Result<WasmInstance, SandboxError>
Instansiasi plugin ke dalam Store dan environment eksekusi baru
Sourcepub fn call_i32(&self, func_name: &str, arg: i32) -> Result<i32, SandboxError>
pub fn call_i32(&self, func_name: &str, arg: i32) -> Result<i32, SandboxError>
Eksekusi fungsi numerik sederhana (misal f(i32) -> i32)
Sourcepub fn call_string_transform(
&self,
func_name: &str,
input: &str,
) -> Result<String, SandboxError>
pub fn call_string_transform( &self, func_name: &str, input: &str, ) -> Result<String, SandboxError>
Eksekusi transformasi string (misal: filter formatting, uppercase, format mata uang)
Trait Implementations§
Source§impl Clone for WasmPlugin
impl Clone for WasmPlugin
Source§fn clone(&self) -> WasmPlugin
fn clone(&self) -> WasmPlugin
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for WasmPlugin
impl !UnwindSafe for WasmPlugin
impl Forget for WasmPlugin
impl Freeze for WasmPlugin
impl Move for WasmPlugin
impl Send for WasmPlugin
impl Sync for WasmPlugin
impl Unpin for WasmPlugin
impl UnsafeUnpin for WasmPlugin
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more