pub struct WasmEngine { /* private fields */ }Expand description
WASM-accessible VPL engine.
Create with new WasmEngine(), load VPL via load(), process events via
processEvent() or processBatch(), and receive output events as JSON.
Implementations§
Source§impl WasmEngine
impl WasmEngine
Sourcepub fn load(&mut self, vpl: &str) -> String
pub fn load(&mut self, vpl: &str) -> String
Load a VPL program. Returns JSON: { ok, streams, error? }.
Replaces any previously loaded program. Call this before processing events.
Sourcepub fn process_event(&mut self, event_json: &str) -> String
pub fn process_event(&mut self, event_json: &str) -> String
Process a single event (JSON object). Returns JSON: { ok, outputs, error? }.
The event JSON must include an event_type field matching a declared event type.
Additional fields are the event data.
{"event_type": "Sensor", "temperature": 150, "zone": "A"}Sourcepub fn process_batch(&mut self, events_json: &str) -> String
pub fn process_batch(&mut self, events_json: &str) -> String
Process a batch of events (JSON array of objects). Returns JSON: { ok, outputs, error? }.
Sourcepub fn get_topology(&self) -> String
pub fn get_topology(&self) -> String
Get the pipeline topology as a JSON graph.
Sourcepub fn get_streams(&self) -> String
pub fn get_streams(&self) -> String
Get loaded stream names as a JSON array.
Sourcepub fn drain_trace(&mut self) -> String
pub fn drain_trace(&mut self) -> String
Drain trace entries as a JSON array.
Trait Implementations§
Source§impl Debug for WasmEngine
impl Debug for WasmEngine
Source§impl Default for WasmEngine
impl Default for WasmEngine
Source§impl From<WasmEngine> for JsValue
impl From<WasmEngine> for JsValue
Source§fn from(value: WasmEngine) -> Self
fn from(value: WasmEngine) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for WasmEngine
impl FromWasmAbi for WasmEngine
Source§impl IntoWasmAbi for WasmEngine
impl IntoWasmAbi for WasmEngine
Source§impl LongRefFromWasmAbi for WasmEngine
impl LongRefFromWasmAbi for WasmEngine
Source§impl OptionFromWasmAbi for WasmEngine
impl OptionFromWasmAbi for WasmEngine
Source§impl OptionIntoWasmAbi for WasmEngine
impl OptionIntoWasmAbi for WasmEngine
Source§impl RefFromWasmAbi for WasmEngine
impl RefFromWasmAbi for WasmEngine
Source§type Anchor = RcRef<WasmEngine>
type Anchor = RcRef<WasmEngine>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for WasmEngine
impl RefMutFromWasmAbi for WasmEngine
Source§impl TryFromJsValue for WasmEngine
impl TryFromJsValue for WasmEngine
Source§impl VectorFromWasmAbi for WasmEngine
impl VectorFromWasmAbi for WasmEngine
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WasmEngine]>
Source§impl VectorIntoWasmAbi for WasmEngine
impl VectorIntoWasmAbi for WasmEngine
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WasmEngine]>) -> Self::Abi
Source§impl WasmDescribeVector for WasmEngine
impl WasmDescribeVector for WasmEngine
impl SupportsConstructor for WasmEngine
impl SupportsInstanceProperty for WasmEngine
impl SupportsStaticProperty for WasmEngine
Auto Trait Implementations§
impl Freeze for WasmEngine
impl !RefUnwindSafe for WasmEngine
impl Send for WasmEngine
impl Sync for WasmEngine
impl Unpin for WasmEngine
impl UnsafeUnpin for WasmEngine
impl !UnwindSafe for WasmEngine
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> 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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.