zng_app

Macro ui_vec

source
macro_rules! ui_vec {
    () => { ... };
    ($node:expr; $n:expr) => { ... };
    ($($nodes:tt)+) => { ... };
}
Expand description

Creates an UiVec containing the arguments.

Note that the items can be node type, ui_vec! automatically calls UiNode::boxed for each item.

ยงExamples

Create a vec containing a list of nodes/widgets:

let widgets = ui_vec![
    Text!("Hello"),
    Text!("World!")
];

Create a vec containing the node repeated n times:

let widgets = ui_vec![Text!(" . "); 10];

Note that this is different from vec![item; n], the node is not cloned, the expression is called n times to generate the nodes.