Module ructe::Template_syntax::a_Value_expressions [] [src]

A value expression can be as simple as @name to get the value of a parameter, but more complicated expressions, including function calls, are also allowed.

Value expressions

A parameter can be used in an expression preceded by an @ sign.

<h1>@name</h1>

If a parameter is a struct or a trait object, its fields or methods can be used, and if it is a callable, it can be called.

<p>The user @user.name has email @user.get_email().</p>
<p>A function result is @function(with, three, arguments).</p>

Standard function and macros can also be used, e.g. for specific formatting needs:

<p>The value is @format!("{:.1}", float_value).</p>