TinyTemplate
TinyTemplate copied to clipboard
Drop `serde_json`
TinyTemplate converts the context structure to serde_json::Value
internally so that it can look up values by string keys. This introduces a dependency on serde_json
even though we don't really do any JSON serialization. If TinyTemplate had its own version of Value
which could be constructed by a custom serde
serializer, we could drop serde_json
and only depend on serde
.
This is not a high priority for Criterion.rs (which depends on serde_json
anyway). I would be happy to accept a pull request though.
Here's my solution for this from a similar project- you're welcome to use it of course: https://github.com/Legend-of-iPhoenix/microtemplate/blob/1dff2cc818ed144ef74f3062ecea7bf7d4c7bb8d/microtemplate_derive/src/lib.rs
Hello! I think the benefits of that approach would be minimal, honestly. The main goal for this ticket is to reduce clean-compile time and code bloat. This would require a new proc-macro and all of the associated machinery so the dependency tree isn't that much smaller (and the macro itself is less likely to already be in the user's dependency tree than serde-derive), and it adds a new derive that users need to apply and a new data model (which would be an API-breaking change in a couple of ways). Thanks for your interest, but I don't think I want to move forward with that approach.