tracks-hust

Crates.iotracks-hust
lib.rstracks-hust
version0.1.0
sourcesrc
created_at2024-01-18 00:11:21.189774
updated_at2024-01-18 00:11:21.189774
descriptionA way to embed Rust into HTML code and use it wherever you'd like.
homepagehttps://github.com/tracks-rs/hust
repositoryhttps://github.com/tracks-rs/hust
max_upload_size
id1103548
size10,422
Ryan Kopf (ryankopf)

documentation

https://github.com/tracks-rs/hust

README

Hust

Hust is an HTML-first way to embed Rust in HTML.

This Crate

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.

Example Usage

<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>
Commit count: 0

cargo fmt