tera
tera copied to clipboard
Make it easer to have functions/filters take rust types
Currently, custom functions and filters must take dynamic values. However, it would be nice to be able to register filters and functions that take and return any rust type that implements Serialize/Deserialize, and have tera deal with doing the conversion.
@Keats did you start any work on this yet? I have implemented this feature for https://github.com/yarn-slinger/yarn-slinger recently and am thinking about implementing it in tera for Hacktober :)
For reference, this book shows how the trick is done.
IT is not implemented yet in v2: https://github.com/Keats/tera2
The main issue (afaik) to use actual types is that Tera uses keyword arguments rather than positional. I didn't dig into it yet but I wasn't sure how to handle that