Crates.io | askama-derive-axum |
lib.rs | askama-derive-axum |
version | 0.1.2 |
created_at | 2025-02-20 11:50:30.351774+00 |
updated_at | 2025-02-21 02:42:58.21856+00 |
description | Derive macro for Askama templates with Axum integration. Replacement for future deprecation of askama_axum crate. |
homepage | |
repository | https://github.com/joshka/askama-derive-axum/ |
max_upload_size | |
id | 1562571 |
size | 37,640 |
Derive macro for implementing IntoResponse
for Askama templates.
This crate provides a derive macro for implementing IntoResponse
for Askama templates. This
allows you to use Askama templates as responses in Axum applications. It is a replacement for
the askama_axum
crate, which will be no longer available in askama 0.13. See askama#1128 and
askama#1119 for more information.
use askama::Template;
use askama_derive_axum::IntoResponse;
#[derive(Template, IntoResponse)]
#[template(path = "index.html")]
struct IndexTemplate {
title: String,
body: String,
}
async fn index() -> IndexTemplate {
IndexTemplate {
title: "My Blog".to_string(),
body: "Hello, world!".to_string(),
}
}
Copyright (c) Josh McKinney
This project is licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md.