pub struct MenuOption {
pub label: String,
pub action: Box<dyn FnMut()>,
}
Expand description
An element in a Menu
.
Consists of a label and a callback. Callbacks can be any function, including functions that call nested menus:
let mut nested_menu = Menu::new(vec![], MenuProps::default());
let show_nested = MenuOption::new("show nested menu", move || nested_menu.show());
Fields§
§label: String
§action: Box<dyn FnMut()>
Implementations§
Trait Implementations§
Source§impl Default for MenuOption
MenuOption::new("exit", || {})
impl Default for MenuOption
MenuOption::new("exit", || {})
Source§fn default() -> MenuOption
fn default() -> MenuOption
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MenuOption
impl !RefUnwindSafe for MenuOption
impl !Send for MenuOption
impl !Sync for MenuOption
impl Unpin for MenuOption
impl !UnwindSafe for MenuOption
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more