pub struct Equation { /* private fields */ }Expand description
The equation Struct is used to solve an equation.
Implementations§
Source§impl Equation
impl Equation
Sourcepub fn new(s: impl Into<String>) -> Result<Equation, EquationError>
pub fn new(s: impl Into<String>) -> Result<Equation, EquationError>
Creates a new equation from a string.
Sourcepub fn set_value(&mut self, variable: &str, value: f64) -> &mut Self
pub fn set_value(&mut self, variable: &str, value: f64) -> &mut Self
Sets the value of a variable in the equation.
Sourcepub fn set_equation(&mut self, variable: &str, equation: Self) -> &mut Self
pub fn set_equation(&mut self, variable: &str, equation: Self) -> &mut Self
Sets the value of a variable to an equation. Note: The equation’s variables used in the original equation will be used, and no already set values will be overwriten.
Sourcepub fn evaluate(&self) -> Result<f64, EquationError>
pub fn evaluate(&self) -> Result<f64, EquationError>
Evaluates the equation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Equation
impl RefUnwindSafe for Equation
impl Send for Equation
impl Sync for Equation
impl Unpin for Equation
impl UnwindSafe for Equation
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