3 releases
new 0.1.2 | Feb 21, 2025 |
---|---|
0.1.1 | Feb 20, 2025 |
0.1.0 | Feb 20, 2025 |
#354 in Procedural macros
78 downloads per month
13KB
Askama-derive-axum
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.
Example
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(),
}
}
License
Copyright (c) Josh McKinney
This project is licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
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.
Dependencies
~2.9–4MB
~75K SLoC