sailfish
sailfish copied to clipboard
RFC 4: Compile time evaluation
Description
Evaluate buffer block (<%= %>) at compile time, inspired by Zapper.
Example
template:
<html>
<head>
<title><%= title %></title>
</head>
<body>
<%= content %>
</body>
</html>
#[derive(TemplateOnce)]
#[template(path = "...")]
#[template(eval(title = "Home"))]
pub struct Home {
content: String
}
Then title is evaluated at compile time. Note that since title must be escaped at compile time, users must pass value as literal