Skip to content

Commit

Permalink
Refactor DefaultNumericTypes into submodule.
Browse files Browse the repository at this point in the history
  • Loading branch information
ISibboI committed Dec 27, 2024
1 parent 8b28dfb commit 81adc0d
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 304 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ path = "src/lib.rs"
regex = { version = "1.11.1", optional = true }
serde = { version = "1.0.213", features = ["derive"], optional = true }
rand = { version = "0.8.5", optional = true }
# num-traits = { version = "0.2.19", optional = true }

[features]
serde = ["dep:serde"]
regex = ["dep:regex"]
rand = ["dep:rand"]
# num-traits = ["dep:num-traits"]

[dev-dependencies]
ron = "0.8.1"
Expand Down
2 changes: 1 addition & 1 deletion src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
error::EvalexprResultValue,
function::Function,
value::{
numeric_types::{DefaultNumericTypes, EvalexprNumericTypes},
numeric_types::{default_numeric_types::DefaultNumericTypes, EvalexprNumericTypes},
value_type::ValueType,
Value,
},
Expand Down
7 changes: 5 additions & 2 deletions src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::ops::RangeInclusive;
use crate::{
token::PartialToken,
value::{
numeric_types::{DefaultNumericTypes, EvalexprNumericTypes},
numeric_types::{default_numeric_types::DefaultNumericTypes, EvalexprNumericTypes},
value_type::ValueType,
},
};
Expand Down Expand Up @@ -464,7 +464,10 @@ pub type EvalexprResultValue<NumericTypes = DefaultNumericTypes> =

#[cfg(test)]
mod tests {
use crate::{value::numeric_types::DefaultNumericTypes, EvalexprError, Value, ValueType};
use crate::{
value::numeric_types::default_numeric_types::DefaultNumericTypes, EvalexprError, Value,
ValueType,
};

/// Tests whose only use is to bring test coverage of trivial lines up, like trivial constructors.
#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt;
use crate::{
error::EvalexprResultValue,
value::{
numeric_types::{DefaultNumericTypes, EvalexprNumericTypes},
numeric_types::{default_numeric_types::DefaultNumericTypes, EvalexprNumericTypes},
Value,
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
error::EvalexprResultValue,
token, tree,
value::{
numeric_types::{DefaultNumericTypes, EvalexprNumericTypes},
numeric_types::{default_numeric_types::DefaultNumericTypes, EvalexprNumericTypes},
TupleType,
},
Context, ContextWithMutableVariables, EmptyType, EvalexprError, EvalexprResult, HashMapContext,
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,10 @@ pub use crate::{
token::PartialToken,
tree::Node,
value::{
numeric_types::{DefaultNumericTypes, EvalexprFloat, EvalexprInt, EvalexprNumericTypes},
numeric_types::{
default_numeric_types::DefaultNumericTypes, EvalexprFloat, EvalexprInt,
EvalexprNumericTypes,
},
value_type::ValueType,
EmptyType, TupleType, Value, EMPTY_VALUE,
},
Expand Down
5 changes: 4 additions & 1 deletion src/operator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use crate::{
context::Context,
error::*,
value::{
numeric_types::{DefaultNumericTypes, EvalexprFloat, EvalexprInt, EvalexprNumericTypes},
numeric_types::{
default_numeric_types::DefaultNumericTypes, EvalexprFloat, EvalexprInt,
EvalexprNumericTypes,
},
Value,
},
ContextWithMutableVariables,
Expand Down
6 changes: 4 additions & 2 deletions src/token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use std::str::FromStr;

use crate::{
error::{EvalexprError, EvalexprResult},
value::numeric_types::{DefaultNumericTypes, EvalexprInt, EvalexprNumericTypes},
value::numeric_types::{
default_numeric_types::DefaultNumericTypes, EvalexprInt, EvalexprNumericTypes,
},
};

mod display;
Expand Down Expand Up @@ -507,7 +509,7 @@ fn parse_dec_or_hex<NumericTypes: EvalexprNumericTypes>(
mod tests {
use crate::{
token::{char_to_partial_token, tokenize, Token},
value::numeric_types::DefaultNumericTypes,
value::numeric_types::default_numeric_types::DefaultNumericTypes,
};
use std::fmt::Write;

Expand Down
2 changes: 1 addition & 1 deletion src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
error::EvalexprResultValue,
token::Token,
value::{
numeric_types::{DefaultNumericTypes, EvalexprNumericTypes},
numeric_types::{default_numeric_types::DefaultNumericTypes, EvalexprNumericTypes},
TupleType, EMPTY_VALUE,
},
Context, ContextWithMutableVariables, EmptyType, HashMapContext,
Expand Down
6 changes: 4 additions & 2 deletions src/value/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error::{EvalexprError, EvalexprResult, EvalexprResultValue};
use std::{convert::TryFrom, ops::RangeInclusive};

use self::numeric_types::{DefaultNumericTypes, EvalexprNumericTypes};
use self::numeric_types::{default_numeric_types::DefaultNumericTypes, EvalexprNumericTypes};

mod display;
pub mod numeric_types;
Expand Down Expand Up @@ -276,7 +276,9 @@ impl<NumericTypes: EvalexprNumericTypes> TryFrom<Value<NumericTypes>> for () {

#[cfg(test)]
mod tests {
use crate::value::{numeric_types::DefaultNumericTypes, TupleType, Value};
use crate::value::{
numeric_types::default_numeric_types::DefaultNumericTypes, TupleType, Value,
};

#[test]
fn test_value_conversions() {
Expand Down
Loading

0 comments on commit 81adc0d

Please sign in to comment.