minijinja icon indicating copy to clipboard operation
minijinja copied to clipboard

Remove mandatory serde dependency

Open mitsuhiko opened this issue 1 year ago • 3 comments

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 avatar Jul 18 '24 17:07 mitsuhiko

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.

mitsuhiko avatar Jul 18 '24 17:07 mitsuhiko

FYI just in case you weren't aware and it affects the decision when/how to do this: the warning added in #541 only shows up when using minijinja as a path dependency. Cargo uses rustc ... --cap-lints=allow to silence lints in dependencies (except rustc future-compat warning) when building crates from registries and even from git repositories. So it's very unlikely that the users who need to see it have ever seen it.

hanna-kruppe avatar Nov 30 '24 09:11 hanna-kruppe

You can use https://docs.rs/build-alert for warnings that show up inside ordinary crates.io dependencies.

dtolnay avatar Nov 30 '24 11:11 dtolnay