Upgrading to new versions
This file only lists breaking changes you need to be aware of when you upgrade to a new askama version. Please see our release notes to get a list of all changes and improvements that might be useful to you.
Also have a look at our blog posts that highlight some of the best features of our releases, and give you more in-dept explanations:
From askama v0.12 to askama v0.13
-
The MSRV of this release is 1.81.
-
The integration crates were removed. Instead of depending on e.g.
askama_axum/askama_axum, please usetemplate.render()to render to aResult<String, askama::Error>.Use e.g.
.map_err(|err| err.into_io_error())?if your web-framework expectsstd::io::Errors, orerr.into_box()if it expectsBox<dyn std::error::Error + Send + Sync>.Please read the documentation of your web-framework how to turn a
Stringinto a web-response. -
The fields
Template::EXTENSIONandTemplate::MIME_TYPEwere removed. -
You may not give variables a name starting with
__askama, or the name of a rust keyword. -
#[derive(Template)]cannot be used withunions. -
|linebreaks,|linebreaksbrand|paragraphbreaksescape their input automatically. -
|jsondoes not prettify its output by default anymore. Use e.g.|json(2)for readable output. -
The binary operators
|,&and^are now calledbitor,bitandandxor, resp. -
The feature
"humansize"was removed. The filter|humansizeis always available. -
The feature
"serde-json"is now called"serde_json". -
The feature
"markdown"was removed. Usecomrakdirectly. -
The feature
"serde-yaml"was removed. Use e.g.yaml-rust2directly.
From rinja v0.3 to askama v0.13
-
The MSRV of this release is 1.81.
-
The projects rinja and askama were re-unified into one project. You need to replace instances of
rinjawithaskama, e.g.-use rinja::Template; +use askama::Template;[dependencies] -rinja = "0.3.5" +askama = "0.13.0" -
The integration crates were removed. Instead of depending on e.g.
rinja_axum/askama_axum, please usetemplate.render()to render to aResult<String, askama::Error>.Use e.g.
.map_err(|err| err.into_io_error())?if your web-framework expectsstd::io::Errors, orerr.into_box()if it expectsBox<dyn std::error::Error + Send + Sync>.Please read the documentation of your web-framework how to turn a
Stringinto a web-response. -
The fields
Template::EXTENSIONandTemplate::MIME_TYPEwere removed. -
The feature
"humansize"was removed. The filter|humansizeis always available. -
You may not give variables a name starting with
__rinja, or the name of a rust keyword. -
#[derive(Template)]cannot be used withunions.
From rinja v0.2 to rinja v0.3
- You should be able to upgrade to v0.3 without changes.
From askama v0.12 to rinja v0.2
-
The MSRV of this release is 1.71.
-
You need to replace instances of
askamawithrinja, e.g.-use askama::Template; +use rinja::Template;[dependencies] -askama = "0.12.1" +rinja = "0.2.0" -
|linebreaks,|linebreaksbrand|paragraphbreaksescape their input automatically. -
|jsondoes not prettify its output by default anymore. Use e.g.|json(2)for readable output. -
The binary operators
|,&and^are now calledbitor,bitandandxor, resp. -
The feature
"serde-json"is now called"serde_json". -
The feature
"markdown"was removed. Usecomrakdirectly. -
The feature
"serde-yaml"was removed. Use e.g.yaml-rust2directly.
From askama v0.11 to askama v0.12
-
The magic
_parentfield to access&**selfwas removed. -
Integration implementations do not need an
extargument anymore. -
The
ironintegration was removed.