Tom Alexander
a622a7e1bc
Add an is_castable() function to stop casting to number for booleans in the @size helper.
4 years ago
Tom Alexander
021a7bd739
Implement the outstanding type casts for OwnedLiterals.
4 years ago
Tom Alexander
eb3b1ae30a
Add stubs for casting the new OwnedBooleans.
4 years ago
Tom Alexander
83c86ff9b3
Move ComparisonNumber into the library and add an OwnedLiteral for booleans.
4 years ago
Tom Alexander
8ab315abfe
Adding stubs for type casting to string and boolean.
4 years ago
Tom Alexander
4731ddaa6b
Remove unused import.
4 years ago
Tom Alexander
648ae5dfdb
Turns out I was wrong, the @size helper attempts to cast to a number regardless of the input and it uses that. Fixed the test.
4 years ago
Tom Alexander
e70f397545
First attempt at fixing by reading all indirect references containing a reference to a single value as the original value is a failure. Turns out the @size helper treats numeric types in indirect references differently.
4 years ago
Tom Alexander
a6c22417e5
Implement Sizable for both OwnedLiterals and serde_json.
4 years ago
Tom Alexander
1a54e35736
Add tests and a Sizable trait for ContextElement.
4 years ago
Tom Alexander
cdd10576e8
Wire up serde_json for the math functions.
4 years ago
Tom Alexander
431b34dac7
Wired up the OwnedLiterals to the math functions.
4 years ago
Tom Alexander
d8b8c223f0
Add stubs for the math functions.
4 years ago
Tom Alexander
2c5c2d239c
Add a special case to not render anything if the method parameter to the math helper is a template to match the official DustJS implementation.
4 years ago
Tom Alexander
b897656cef
Fix all of the math test except for block template-based methods.
4 years ago
Tom Alexander
d9f10290f5
Math helper nearly done, test almost passes.
4 years ago
Tom Alexander
28a4fea96f
Remove RValue from ParametersContext so I can re-use it for calculated values from math.
4 years ago
Tom Alexander
dcbf8e83f6
Implement number casting.
4 years ago
Tom Alexander
9eb70f436c
Starting a type casting trait
4 years ago
Tom Alexander
d6ad7c28f3
Move MathNumber into the library.
...
While this will be used for the OwnedLiterals since they must always exhibit the original DustJS behavior, I am going to keep exposing separate math functions for ContextElement instead of simply requiring them to implement Into<MathNumber> since people might want to implement math in unusual ways with unusual types.
4 years ago
Tom Alexander
df0ae05648
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.
4 years ago
Tom Alexander
db11677b22
Implement addition for OwnedLiterals.
4 years ago
Tom Alexander
d99aa44d8e
Add support for negative integers.
4 years ago
Tom Alexander
978bbe6eb3
Implemented float literals for OwnedLiterals, not yet for serde_json.
4 years ago
Tom Alexander
f2740987ec
Add a parent to ParametersContext so we can chain parameters contexts for use with the select helper.
4 years ago
Tom Alexander
d06fbea288
Remove unused code and clean up warnings.
4 years ago
Tom Alexander
b1a85165b0
All tests passing!
4 years ago
Tom Alexander
8cbb31251c
port over the equals/not equals helpers.
4 years ago
Tom Alexander
71592a9a32
Switching back to a Vec because inserting multiple elements into the linked list structure while maintaining ownership of each node proved to be difficult.
4 years ago
Tom Alexander
77b842f8de
Implement IntoContextElement for ParametersContext.
4 years ago
Tom Alexander
02259b9bd6
Create from_borrowed and from_owned constructors for IceResult and BreadcrumbTreeElement.
...
In an effort to keep track of how often memory is getting heap allocated, I am implementing constructors for IceResult and BreadcrumbTreeElement. This should limit the places that I call Rc::new and allow me to place tracing code into it later to ensure all code paths doing heap allocation make sense.
4 years ago
Tom Alexander
3c15e35b67
Finished constructor for ParametersContext.
4 years ago
Tom Alexander
ed7d80de6c
Handling RVPath for ParametersContext constructor.
4 years ago
Tom Alexander
f9dea70d23
Implement conversion from IceResult into BreadcrumbTreeNode.
...
I believe this change will remove an extra heap allocation I was doing in the new_breadcrumbs_* functions for the explicit context by adding support for converting from Rc<dyn ContextElement> to Rc<dyn IntoContextElement> without copying the underlying data. This should allow conversion of the IceResult::Owned variant to the BreadcrumbTreeElement::Owned variant without extra copying.
4 years ago
Tom Alexander
7253c7d99e
Implement function to convert IceResult into a BreadcrumbTreeElement.
4 years ago
Tom Alexander
18c1687064
Starting the constructor for ParametersContext.
4 years ago
Tom Alexander
f4f309caad
Working implementation of into_context_element for RValue.
4 years ago
Tom Alexander
303f092c30
Running into lifetime issues again.
4 years ago
Tom Alexander
da15439946
Start of IceResult to return owned values from into_context_element.
4 years ago
Tom Alexander
7789e6245d
I need to be able to returned owned data from into_context_element.
4 years ago
Tom Alexander
064027e77b
Worked around a lifetime issue with into_context_element.
4 years ago
Tom Alexander
b74dc394a8
Switched to returning an Option for into_context_element().
4 years ago
Tom Alexander
3aaf7f9987
I think I need to make into_context_element return an Option.
...
The reason is, missing values for paths are not equal to null so I can't use an OwnedLiteral unless I create a special "walking failed" OwnedLiteral.
4 years ago
Tom Alexander
09e0b046a0
Copy over the implementation of ContextElement for OwnedLiteral which will be the result of calling IntoContextElement on RValues.
4 years ago
Tom Alexander
ff74d78fdb
Starting the new parameters context object.
4 years ago
Tom Alexander
a578b57f12
Switch the call for IntoContextElement back to a static integer so it compiles again.
4 years ago
Tom Alexander
21b9e9282b
Ran into issue: Can't returned owned data when its expecting a trait object.
4 years ago
Tom Alexander
737c98d8b7
Add the renderer to calls to convert to a context element.
4 years ago
Tom Alexander
917da5a073
Put IntoContextElement everywhere. It compiles again.
4 years ago
Tom Alexander
975ab278ef
Starting an IntoContextElement trait to allow for delayed evaluation.
4 years ago