More than 1 year has passed since last update.
Rust + Actix-web でのHTMLのテンプレートエンジンについて
前書き
RUST + Actix-web の開発において、何らかのHTMLテンプレートをレンダーするテンプレートエンジンを探していたのですが、Actix-webの実装例をまとめた公式サイト(actix/examples)を見ても複数出てきて情報が過多だったので、ざっくり情報を集めてみた際の備忘録 (2023/11/30時点での情報) になります。
比較対象
actix/examples のリポジトリの /templating/ 配下にあるものを候補としてます。
比較対象にしなかったもの
下記はactix/examples のリポジトリの /templating/ 配下になかったので今回は非対象にしました。
Github のリポジトリベースでの比較 (確認日: 2023/11/30)
Githubのリポジトリの情報でざっくり比較すると下記になりました。
各列の上位2件まで色を緑に変更しております。
| 名称 | Star | Fork | Issue (Open) |
Issue (Close) |
最新Tag | 1つ前のマイナーTag | URL |
|---|---|---|---|---|---|---|---|
| Askama | 249 | 0.12.0 (2023/03/06) |
0.11.0 (2021/12/22) |
https://github.com/djc/askama | |||
| Fluent Templates | 122 | 17 | 12 | 22 | v0.8.0 (2022/08/08) |
v0.7.1 (2022/03/16) |
https://github.com/XAMPPRocky/fluent-templates |
| handlebars-rust | 1.1k | 132 | 25 | https://github.com/sunng87/handlebars-rust | |||
| MiniJinja | 1.1k | 72 | 4 | 114 | 0.34.0 (2023/06/02) |
https://github.com/mitsuhiko/minijinja | |
| SailFish | 624 | 50 | 30 | 49 | v0.8.1 (2023/10/10) |
https://github.com/rust-sailfish/sailfish | |
| Tera | v1.18.1 (2023/03/16) |
v1.17.1 (2022/09/19) |
https://github.com/Keats/tera | ||||
| TinyTemplate | 176 | 42 | 12 | 13 | 1.2.1 (2021/03/04) |
1.1.0 (2020/06/01) |
https://github.com/bheisler/TinyTemplate |
| Yarte | 265 | 16 | 29 | 69 | yarte-v0.15.7 (2022/09/07) |
yarte-v0.15.6 (2022/09/07) ※1 |
https://github.com/zzau13/yarte |
※1 直近のマイナーバージョンのTagが存在しないので、もっとも古いTagを記載。
実装の例
actix/examples のリポジトリの /templating/ 配下にある main.rs を転記しています。
詳細な情報についてはactix/examples のリポジトリの /templating/ 配下をご確認ください。
Askama
source: https://github.com/actix/examples/blob/master/templating/askama/src/main.rs
Fluent Templates
source: https://github.com/actix/examples/blob/master/templating/fluent/src/main.rs
handlebars-rust
source: https://github.com/actix/examples/blob/master/templating/handlebars/src/main.rs
MiniJinja
source: https://github.com/actix/examples/blob/master/templating/minijinja/src/main.rs
SailFish
source: https://github.com/actix/examples/blob/master/templating/sailfish/src/main.rs
Tera
source: https://github.com/actix/examples/blob/master/templating/tera/src/main.rs
TinyTemplate
source: https://github.com/actix/examples/blob/master/templating/tinytemplate/src/main.rs
Yarte
source: https://github.com/actix/examples/blob/master/templating/yarte/src/main.rs
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
