column

Macro column 

Source
macro_rules! column {
    ( $( $ee:expr ),* ) => { ... };
    ( $( $ee:expr ),+ , ) => { ... };
}
Expand description

Make a Column widget

§Syntax

Collection :
   column! [ Items? ]

Items :
   (Item ,)* Item ,?

§Stand-alone usage

When used as a stand-alone macro, column! [/* ... */] is just syntactic sugar for Column::new(kas::collection! [/* ... */]).

In this case, Item may be:

  • A string literal (interpreted as a label widget), optionally followed by an align or pack method call
  • An expression yielding an object implementing Widget<Data = _A>

In case all Item instances are a string literal, the data type of the column! widget will be (); otherwise the data type of the widget is _A where _A is a generic type parameter of the widget.

§Usage within widget layout syntax

When called within widget layout syntax, column! may be evaluated as a recursive macro and the result does not have a specified type, except that methods map_any, align and pack are supported via emulation.

In this case, Item is evaluated using widget layout syntax. This is broadly similar to the above with a couple of exceptions:

  • Supported layout macros do not need to be imported to the module scope
  • An Item may be a #[widget] field of the widget

§Example

let my_widget = kas_widgets::column! [
    "one",
    "two",
];