Open Directory opened 2 years ago
You can have a look at https://github.com/Keats/tera/blob/master/src/builtins/functions.rs for some examples of built-in functions
after figuring it out ill update this issue with how instead the documentation is very vague and bad. How should anyone know that the Result type is a special wrapper and not built in. whats the Function type from? How was anyone supposed to know that serde_json is used here. The example code should be updated with all necessary imports that it uses. Additionally i think it would be a better example if instead it was a tera::Function implementation on an empty struct rather than a function that returns a Box. Considering how awful this documentation was theres probably other awful code examples in the rest of the docs.
Sorry for the awful documentation. Have you seen the awful API documentation as well on https://docs.rs/tera/latest/tera/trait.Function.html? That should answer some of your questions.
https://tera.netlify.app/docs/#functions
the docs seem outdated. this isnt valid rust i dont think.