Crate beard[−][src]
Expand description
beard
In opposition to mustache. Here the goal instead of mustache is to leverage as much as possible rust’s type system to detect error case and therefor to make the rendering deterministic. If you are looking for something that is going to be portable outside of rust you should checkout mustache.
beard
is a macro that will generate the necessary rust code
to serialise the given template. You can achieve the same thing
by writing the code yourself (calling std::io::Write appropriate
methods). beard
is simply an help to do that and to make it
easier to maintain the templates.
Example
use beard::beard; let name = "Arthur"; let list = ["Bubble Bath", "Unicorn Crunchy Oat"]; beard! { output, "Hi " { name } "\n" "\n" "Confirmation order about the following items:\n" for item in ( list ) { " * " { item } "\n" } "\n" "Your order will be ship to you once everything is ready.\n" };
The Example below will generate a string in the output
:
Hi Arthur
Confirmation order about the following items:
* Bubble Bath
* Unicorn Crunch Oat
Your order will be ship to you once everything is ready.
Macros
beard | macro to call to generate the function stream of generating formatted output. |