refactor(eval): rename math_constants to constants
This commit is contained in:
3 files changed
+3
-3
No files matched your search
File renamed without changes.
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
use rust_decimal::MathematicalOps;
|
use rust_decimal::MathematicalOps;
|
||||||
|
|
||||||
use crate::math::{
|
use crate::math::{
|
||||||
functions, math_constants,
|
constants, functions,
|
||||||
types::{Expression, Operator},
|
types::{Expression, Operator},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ pub fn eval_expr(expr: Expression) -> Expression {
|
|||||||
match expr {
|
match expr {
|
||||||
Expression::Number(_) => expr,
|
Expression::Number(_) => expr,
|
||||||
Expression::Variable(name) => {
|
Expression::Variable(name) => {
|
||||||
if let Some(value) = math_constants::get(&name) {
|
if let Some(value) = constants::get(&name) {
|
||||||
Expression::Number(value)
|
Expression::Number(value)
|
||||||
} else {
|
} else {
|
||||||
Expression::Variable(name)
|
Expression::Variable(name)
|
||||||
|
|||||||
+1
-1
@@ -3,11 +3,11 @@ use crate::math::types::Expression;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
mod constants;
|
||||||
mod display;
|
mod display;
|
||||||
mod eval;
|
mod eval;
|
||||||
mod functions;
|
mod functions;
|
||||||
mod lexer;
|
mod lexer;
|
||||||
mod math_constants;
|
|
||||||
mod parser;
|
mod parser;
|
||||||
|
|
||||||
pub mod types;
|
pub mod types;
|
||||||
|
|||||||
Reference in new issue
Block a user