2.0.0-alpha.0
Pre-release
Pre-release
Release Notes
This is a major update to MiniJinja that changes a lot of core internals and
cleans up some APIs. In particular it resolves somes limitations in the engine
in relation to working with dynamic objects, unlocks potentials for future
performance improvments and enhancements.
It's very likely that you will need to do changes to your code when upgrading,
particular when implementing dynamic objects. In short:
StructObjectandSeqObjectare gone. They have been replaced by improved
APIs directly onObject. Please refer to the updated documentation to see
how these objects behave now. For the most part code should become quite a bit
clearer during the upgrade.ObjectKindhas been replaced byObjectRepr. Rather than holding a reference
to aStructObjectorSeqObjectthis now is a simple enum that just indicates
how that object serializes, renders and behaves.Objectno longer usesfmt::Displayfor rendering. Instead the new
Object::rendermethod is used which has a default implementation.- The
Objecttrait has been completely transformed and the new type-erased type
DynObjecthas been added to work with unknown objects. This trait has an
improved user experience and more flexibility. It's now possible to implement
any non-primitive value type including maps with non string keys which was previously
not possible. ValueKindis now non exhaustive and got a log of new value types. This resolves
various issues in particular in relationship with iterators. As a result of this
functions will no longer accidentally serialize into empty objects for example.Value::from_iteratorhas been replaced by the newValue::make_iterable,
Value::make_object_iterableandValue::make_one_shot_iterator. The direct
replacement isValue::make_one_shot_iteratorbut for most uses it's strongly
recommended to use one of the other APIs instead. This results in a much improved
user experience as it's possible to iterate over such values more than once.- The
Syntaxtype has been replaced by theSyntaxConfigtype. It uses a builder
pattern to reconfigure the delimiters.
For upgrade instructions read the UPDATING guide.
Other Changes:
- Added a new
Environment::templatesmethod that iterates over loaded templates. #471 - Reverse iteration and slicing now return iterables instead of real sequences.
- The engine no longer reports iterable as sequences.
- The value iterator returned by
Value::try_iternow holds a reference
to theValueinternally via reference counting. DynObjectnow replacesArc<Object>.- The debug printing of some objects was simplified.
- Added the
iterabletest. #475 - The parser no longer panics when using dotted assignments in unexpected places. #479
- The CLI now enables unicode support by default.
Value::from_serializableis nowValue::from_serialize.- Ranges are now iterables and no longer sequences and their maximum number of iterations
was raised to 100000. #493 Value::fromis now implemented forErroras public API to create invalid values.
Previously this behavior was hidden internally in the serde support. #495
Install minijinja-cli 2.0.0-alpha.0
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mitsuhiko/minijinja/releases/download/2.0.0-alpha.0/minijinja-cli-installer.sh | shInstall prebuilt binaries via powershell script
powershell -c "irm https://github.com/mitsuhiko/minijinja/releases/download/2.0.0-alpha.0/minijinja-cli-installer.ps1 | iex"Download minijinja-cli 2.0.0-alpha.0
| File | Platform | Checksum |
|---|---|---|
| minijinja-cli-aarch64-apple-darwin.tar.xz | Apple Silicon macOS | checksum |
| minijinja-cli-x86_64-apple-darwin.tar.xz | Intel macOS | checksum |
| minijinja-cli-x86_64-pc-windows-msvc.zip | x64 Windows | checksum |
| minijinja-cli-x86_64-unknown-linux-gnu.tar.xz | x64 Linux | checksum |
| minijinja-cli-x86_64-unknown-linux-musl.tar.xz | x64 MUSL Linux | checksum |