Start of implementation for serde_json but I'm going to change my approach.

The permutations are pretty intense, so I think I'm going to do the same design I did for comparison where I have a JsonNumber (but I'll call this one MathNumber and rename JsonNumber to ComparisonNumber), convert the types to that, and then do the math.
This commit is contained in:
Tom Alexander
2020-06-13 18:34:13 -04:00
parent db11677b22
commit df0ae05648
3 changed files with 60 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ pub use context_element::Walkable;
pub use errors::CompileError;
pub use errors::RenderError;
pub use errors::WalkError;
pub use parameters_context::math_ints;
pub use renderer::compile_template;
pub use renderer::DustRenderer;
pub use select_context::SelectContext;

View File

@@ -388,7 +388,7 @@ impl CompareContextElement for OwnedLiteral {
/// For math operations that take in integers and return integers
/// (add, subtract, multiply)
fn math_ints<L, R, F>(left: L, right: R, operation: F) -> Option<OwnedLiteral>
pub fn math_ints<L, R, F>(left: L, right: R, operation: F) -> Option<OwnedLiteral>
where
L: Into<i128>,
R: Into<i128>,