Macro horrorshow::labels
[−]
[src]
macro_rules! labels { ($($tail:tt)+) => { ... }; }
Utility macro for generating a space-delimited string from a set of labels;
some of which may be conditionally included into the final string.
Labels are anything that implements the RenderOnce trait (e.g. String or &str).
This macro is an alias of: labels_sep_by!(" "; maybe_label,...)
Usage: labels!(maybe_label,...)
-
maybe_label-- Eitherlabel_expression, orlabel_expression => cond_test. -
label_expression-- An expression that returns a label that implements theRenderOncetrait (e.g.Stringor&str). -
label_expression => cond_test-- Conditionally includelabel_expressionwhenevercond_testistrue.cond_testis an expression that returns eithertrueorfalse.
This useful in generating class attribute as follows:
html! { div(class = labels!("active" => true, "button-style")) { : "This is a button" } }