| Crates.io | rustapi-view |
| lib.rs | rustapi-view |
| version | 0.1.207 |
| created_at | 2026-01-05 20:44:29.729809+00 |
| updated_at | 2026-01-26 00:03:55.66641+00 |
| description | Template rendering support for RustAPI - Server-side HTML with Tera templates |
| homepage | |
| repository | https://github.com/Tuntii/RustAPI |
| max_upload_size | |
| id | 2024551 |
| size | 92,739 |
Server-side rendering for RustAPI using Tera.
Create dynamic HTML web applications with the powerful Jinja2-like syntax of Tera.
src/main.rs
use rustapi_view::{View, Context};
#[get("/")]
async fn index() -> View {
let mut ctx = Context::new();
ctx.insert("title", "My Blog");
ctx.insert("posts", &vec!["Post 1", "Post 2"]);
View::new("index.html", ctx)
}
templates/index.html
<h1>{{ title }}</h1>
<ul>
{% for post in posts %}
<li>{{ post }}</li>
{% endfor %}
</ul>