Crates.io | tracks-hust |
lib.rs | tracks-hust |
version | 0.1.0 |
source | src |
created_at | 2024-01-18 00:11:21.189774 |
updated_at | 2024-01-18 00:11:21.189774 |
description | A way to embed Rust into HTML code and use it wherever you'd like. |
homepage | https://github.com/tracks-rs/hust |
repository | https://github.com/tracks-rs/hust |
max_upload_size | |
id | 1103548 |
size | 10,422 |
Hust is an HTML-first way to embed Rust in HTML.
This crate exports a function called preprocess_and_generate_rust_code
. It is meant to be used in your own proc macros.
To use hust without implementing your own macro, you should instead use the crate hust-macro
.
<h1>User</h1>
<div class="user">
<%= &user.username %>
</div>
Or for more complex usage:
<h1>All Users</h1>
<div class="py-2">
<%= &users.len().to_string() %> users found.
</div>
<% for user in users { %>
<div class="user">
<a href="/users/<%= &user.id.to_string() %>">
<%= &user.username %>
</a>
</div>
<% } %>
<a href="/users/new" class="btn btn-primary">New User</a>