askama-derive-axum

Crates.ioaskama-derive-axum
lib.rsaskama-derive-axum
version0.1.2
created_at2025-02-20 11:50:30.351774+00
updated_at2025-02-21 02:42:58.21856+00
descriptionDerive macro for Askama templates with Axum integration. Replacement for future deprecation of askama_axum crate.
homepage
repositoryhttps://github.com/joshka/askama-derive-axum/
max_upload_size
id1562571
size37,640
Josh McKinney (joshka)

documentation

https://docs.rs/askama-derive-axum

README

Askama-derive-axum

crate-badge docs-badge repo-badge license-badge

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:

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.

Commit count: 14

cargo fmt