#web-framework #erb #rails-inspired #rust

tracks-hust

A way to embed Rust into HTML code and use it wherever you'd like

1 unstable release

0.1.0 Jan 18, 2024

#392 in #web-framework

Download history 5/week @ 2024-01-12 4/week @ 2024-02-16 10/week @ 2024-02-23 5/week @ 2024-03-01 1/week @ 2024-03-08 1/week @ 2024-03-15 16/week @ 2024-03-29 5/week @ 2024-04-05 73/week @ 2024-04-12

94 downloads per month
Used in hust-macro

MIT license

11KB
213 lines

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>

Dependencies

~1.5MB
~33K SLoC