Macro relm4_macros::menu
source · [−]menu!() { /* proc-macro */ }
Expand description
A macro to create menus.
Example
// Define some actions
relm4::new_action_group!(WindowActionGroup, "win");
relm4::new_stateless_action!(TestAction, WindowActionGroup, "test");
relm4::new_stateful_action!(TestU8Action, WindowActionGroup, "test2", u8, u8);
// Create a `MenuModel` called `menu_model`
relm4_macros::menu! {
main_menu: {
"Test" => TestAction,
"Test2" => TestAction,
"Test toggle" => TestU8Action(1_u8),
section! {
"Section test" => TestAction,
"Test toggle" => TestU8Action(1_u8),
},
section! {
"Test" => TestAction,
"Test2" => TestAction,
"Test Value" => TestU8Action(1_u8),
}
}
};