Struct MenuItem
Source pub struct MenuItem<'a> { }
Expand description
Individual menu item data.
Create a new menu item.
§Arguments
text - Display text for the menu item
§Example
let item = MenuItem::new("Copy");
Set the leading icon for the menu item.
§Arguments
icon - Icon identifier (e.g., “copy”, “cut”, “paste”)
§Example
let item = MenuItem::new("Copy").leading_icon("content_copy");
Set the trailing icon for the menu item.
§Arguments
icon - Icon identifier (e.g., “keyboard_arrow_right”, “check”)
§Example
let item = MenuItem::new("Save").trailing_icon("keyboard_arrow_right");
Enable or disable the menu item.
§Arguments
enabled - Whether the menu item should be interactive
§Example
let item = MenuItem::new("Paste").enabled(false);
Add a divider after the menu item.
§Arguments
divider - Whether to show a divider line after this item
§Example
let item = MenuItem::new("Copy").divider_after(true);
Set the action to be performed when the menu item is clicked.
§Arguments
f - Closure to execute when the item is clicked
§Example
let item = MenuItem::new("Delete")
.on_click(|| println!("Item deleted"));
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Instruments this type with the provided
Span, returning an
Instrumented wrapper.
Read more
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.