conrod::widget_ids! [] [src]

macro_rules! widget_ids {
    ( $widget_id:ident , $($rest:tt)* ) => { ... };
    ( $widget_id:ident with $step:expr , $($rest:tt)* ) => { ... };
    ( $prev_id:expr => $widget_id:ident , $($rest:tt)* ) => { ... };
    ( $prev_id:expr => $widget_id:ident with $step:expr , $($rest:tt)* ) => { ... };
    () => { ... };
    ( $prev_id:expr => ) => { ... };
    ( $widget_id:ident ) => { ... };
    ( $widget_id:ident with $step:expr ) => { ... };
    ( $prev_id:expr => $widget_id:ident ) => { ... };
    ( $prev_id:expr => $widget_id:ident with $step:expr ) => { ... };
}

Generate a list of unique IDs given a list of identifiers.

This is the recommended way of generating WidgetIds as it greatly lessens the chances of making errors when adding or removing widget ids.

Each Widget must have its own unique identifier so that the Ui can keep track of its state between updates.

To make this easier, we provide the widget_ids macro, which generates a unique WidgetId for each identifier given in the list.

The with n syntax reserves n number of WidgetIds for that identifier rather than just one.

This is often useful in the case that you need to set multiple Widgets in a loop or when using the widget::Matrix.

Note: Make sure when that you remember to #[macro_use] if you want to use this macro - i.e.

#[macro_use] extern crate conrod;

Also, if your list has a large number of identifiers (~64 or more) you may find this macro hitting rustc's recursion limit (this will show as a compile error). To fix this you can try adding the following to your crate root.

#![recursion_limit="512"]

This will raise the recursion limit from the default (~64) to 512. You should be able to set it to a higher number if you find it necessary.