RootFormula

Struct RootFormula 

Source
pub struct RootFormula { /* private fields */ }
Expand description

Base primitive to use in other formulas.

Implementations§

Source§

impl RootFormula

Source

pub fn new<T: Into<FormulaArgument>>(value: T) -> Self

Creates new RootFormula.

Source

pub fn parse<T: for<'a> GetFunction<'a>>( expression: &str, formulas: &T, ) -> Result<Self, ParserError>

Parses &str into RootFormula.

§Errors

will return Err if non valid expression is passed.

Trait Implementations§

Source§

impl<T: Into<Self>> Add<T> for RootFormula

Source§

type Output = RootFormula

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl Clone for RootFormula

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RootFormula

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RootFormula

Source§

fn default() -> RootFormula

Returns the “default value” for a type. Read more
Source§

impl<T: Into<Self>> Div<T> for RootFormula

Source§

type Output = RootFormula

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl Evaluate for RootFormula

Source§

fn eval(&self, args: &dyn GetVariable) -> Result<f64, EvaluationError>

Evaluates value of formula, args contains variables. Read more
Source§

impl<T: Into<FormulaArgument>> From<T> for RootFormula

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl FunctionLike for RootFormula

Source§

fn collapse_inner(&mut self) -> Result<(), MathError>

Simplifies function arguments. For example if one of the function arguments is “1 + 2”, this method will simplify it to “3” Read more
Source§

fn set_all_variables_shared(&mut self, args: &dyn GetVariable)

Sets variables present in function to formulas stored in args as shared function. If function has some inner state and set as shared in different formulas, inner state will be shared.
Source§

fn set_all_variables_owned(&mut self, args: &dyn GetVariable)

Sets variables present in function to formulas stored in args as owned function. If function has some inner state and set as owned in different formulas, inner state will be different.
Source§

fn set_variable_shared(&mut self, name: &Variable, function: &Arc<RootFormula>)

Sets variable name in function to function as shared function. If function has some inner state and set as shared in different formulas, inner state will be shared.
Source§

fn set_variable_owned(&mut self, name: &Variable, function: &RootFormula)

Sets variable name in function to function as owned function. If function has some inner state and set as owned in different formulas, inner state will be different.
Source§

fn clone_into_box(&self) -> Box<dyn FunctionLike>

Creates clone of object stored in Box as trait object
Source§

impl IsConst for RootFormula

Source§

fn is_const(&self) -> bool

Returns true if formula returns same value for every .eval(…) call, else returns false.
Source§

impl<T: Into<Self>> Mul<T> for RootFormula

Source§

type Output = RootFormula

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: Into<Self>> Sub<T> for RootFormula

Source§

type Output = RootFormula

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.