pub struct WasmCalculator { /* private fields */ }Expand description
WASM Calculator - browser-ready calculator
Implementations§
Source§impl WasmCalculator
impl WasmCalculator
Sourcepub fn with_validator(validator: AnomalyValidator) -> Self
pub fn with_validator(validator: AnomalyValidator) -> Self
Creates a calculator with custom Anomaly validator
Sourcepub fn append_input(&mut self, s: &str)
pub fn append_input(&mut self, s: &str)
Appends to the input
Sourcepub fn clear_input(&mut self)
pub fn clear_input(&mut self)
Clears only the input (keeps result)
Sourcepub fn evaluate(&mut self) -> CalcResult<f64>
pub fn evaluate(&mut self) -> CalcResult<f64>
Evaluates the current input expression
Sourcepub fn result_display(&self) -> String
pub fn result_display(&self) -> String
Gets a formatted result display string
Sourcepub fn history_entries(&self) -> Vec<String>
pub fn history_entries(&self) -> Vec<String>
Gets history as JSON-like string array (for WASM interop)
Sourcepub fn history_entries_rev(&self) -> Vec<String>
pub fn history_entries_rev(&self) -> Vec<String>
Gets history entries in reverse order (newest first)
Sourcepub fn jidoka_status(&self) -> &[String]
pub fn jidoka_status(&self) -> &[String]
Gets the Anomaly status messages
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clears the history
Sourcepub fn history_len(&self) -> usize
pub fn history_len(&self) -> usize
Gets the number of history entries
Sourcepub fn recall_history(&self, index: usize) -> Option<&HistoryEntry>
pub fn recall_history(&self, index: usize) -> Option<&HistoryEntry>
Recalls a history entry by index
Sourcepub fn use_last_result(&mut self)
pub fn use_last_result(&mut self)
Uses the last result as input for chained calculations
Trait Implementations§
Source§impl Debug for WasmCalculator
impl Debug for WasmCalculator
Auto Trait Implementations§
impl Freeze for WasmCalculator
impl RefUnwindSafe for WasmCalculator
impl Send for WasmCalculator
impl Sync for WasmCalculator
impl Unpin for WasmCalculator
impl UnsafeUnpin for WasmCalculator
impl UnwindSafe for WasmCalculator
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