Macro horrorshow::labels_sep_by [] [src]

macro_rules! labels_sep_by {
    (@inner_expand $has_before:expr; $sep:expr; $tmpl:ident $item:expr) => { ... };
    (@inner_expand $has_before:expr; $sep:expr; $tmpl:ident $item:expr => $should_include:expr) => { ... };
    (@inner_expand $has_before:expr; $sep:expr; $tmpl:ident $item:expr, $($tail:tt)+) => { ... };
    (@inner_expand $has_before:expr; $sep:expr; $tmpl:ident $item:expr => $should_include:expr, $($tail:tt)+) => { ... };
    ($sep:expr; $item:expr) => { ... };
    ($sep:expr; $item:expr => $should_include:expr) => { ... };
    ($sep:expr; $item:expr, $($tail:tt)+) => { ... };
    ($sep:expr; $item:expr => $should_include:expr, $($tail:tt)+) => { ... };
}

Utility macro for generating a delimited string from a set of labels; some of which may be conditionally included into the final string. The delimiter/seperator and labels are anything that implements the RenderOnce trait (e.g. String or &str).

Usage: labels_sep_by!(seperator; maybe_label,...)

This useful in generating style attribute as follows:

html! {
    div(style = labels_sep_by!(";"; "color: #000" => true, "font-weight: bold")) {
        : "This is a button"
    }
}