mitsuhiko / minijinja

MiniJinja is a powerful but minimal dependency template engine for Rust compatible with Jinja/Jinja2
https://docs.rs/minijinja/
Apache License 2.0
1.56k stars 86 forks source link

Remove mandatory serde dependency #539

Open mitsuhiko opened 1 month ago

mitsuhiko commented 1 month ago

This PR makes serde optional in MiniJinja. The way to use this is to disable default features which also turns off serde. Unfortunately this is not semver compatible as it means that anyone currently using MiniJinja without serde will experience breakage.

Additionally it changes the behavior of context! to take things by value. The benefit of this is that the macro can now support both Into<Value> and Serialize as conversions.

This will have to go into a new major version.

Fixes #528

mitsuhiko commented 1 month ago

Another option entirely is to no longer use serde in public interfaces at all and force people to use Value::from_serialize explicitly. Then context! and other functions could use Into<Value> instead. I'm not convinced that this is an amazing idea but it would make the interface potentially simpler. That however would definitely require a major.