Expand description
A Computer object calculates expressions and has variables.
let mut computer = Computer::new();
assert_eq!(computer.eval("a = 2"), Ok(2.0));
assert_eq!(computer.eval("a * 3"), Ok(6.0));
assert_eq!(
Computer::new().eval("a"),
Err(EvalError::ComputeError(ComputeError::UnrecognizedIdentifier("a")))
);
Fields
variables: HashMap<String, f64>
Implementations
Trait Implementations
impl StructuralPartialEq for Computer
Auto Trait Implementations
impl RefUnwindSafe for Computer
impl Send for Computer
impl Sync for Computer
impl Unpin for Computer
impl UnwindSafe for Computer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more