pub struct WasmRunner<E: DemoEngine> { /* private fields */ }Expand description
Generic WASM runner that wraps any DemoEngine.
This is used internally by concrete WASM exports. It cannot be exported via wasm-bindgen directly due to generic type limitations.
Implementations§
Source§impl<E: DemoEngine> WasmRunner<E>
impl<E: DemoEngine> WasmRunner<E>
Sourcepub fn engine_mut(&mut self) -> &mut E
pub fn engine_mut(&mut self) -> &mut E
Get mutable reference to the engine.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if runner is running.
Sourcepub fn toggle_pause(&mut self) -> bool
pub fn toggle_pause(&mut self) -> bool
Toggle pause state.
Sourcepub fn set_paused(&mut self, paused: bool)
pub fn set_paused(&mut self, paused: bool)
Set paused state directly.
Sourcepub fn step(&mut self) -> bool
pub fn step(&mut self) -> bool
Advance the simulation by one step.
Returns false if paused or complete.
Sourcepub fn run_steps(&mut self, num_steps: u32) -> u32
pub fn run_steps(&mut self, num_steps: u32) -> u32
Run multiple steps.
Returns the number of steps completed.
Sourcepub fn evaluate_criteria(&self) -> Vec<CriterionResult>
pub fn evaluate_criteria(&self) -> Vec<CriterionResult>
Evaluate falsification criteria.
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Get step count.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if complete.
Source§impl<E: DemoEngine> WasmRunner<E>
impl<E: DemoEngine> WasmRunner<E>
Sourcepub fn state_json(&self) -> String
pub fn state_json(&self) -> String
Get state as JSON string for JavaScript consumption.
Sourcepub fn wasm_state(&self) -> WasmState
pub fn wasm_state(&self) -> WasmState
Get full WASM state for JavaScript.
Sourcepub fn wasm_state_json(&self) -> String
pub fn wasm_state_json(&self) -> String
Get full state as JSON string.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for WasmRunner<E>where
E: Freeze,
impl<E> RefUnwindSafe for WasmRunner<E>where
E: RefUnwindSafe,
impl<E> Send for WasmRunner<E>where
E: Send,
impl<E> Sync for WasmRunner<E>where
E: Sync,
impl<E> Unpin for WasmRunner<E>where
E: Unpin,
impl<E> UnsafeUnpin for WasmRunner<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for WasmRunner<E>where
E: UnwindSafe,
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