pub struct MenuItem {
pub label: String,
pub icon: Option<&'static str>,
pub kbd: Option<String>,
pub danger: bool,
pub disabled: bool,
pub separator: bool,
pub sub: Option<Vec<MenuItem>>,
}Expand description
One entry of a menu.
Fields§
§label: String§icon: Option<&'static str>An icon body (icons).
kbd: Option<String>A shortcut hint (Ctrl+K).
danger: boolRed (a destructive action).
disabled: boolGreyed, not pickable (no hit id).
separator: boolA divider line instead of an item.
sub: Option<Vec<MenuItem>>A nested submenu (G12), shown when the row carries .open.
Implementations§
Source§impl MenuItem
impl MenuItem
pub fn new(label: impl Into<String>) -> MenuItem
pub fn separator() -> MenuItem
pub fn icon(self, body: &'static str) -> MenuItem
pub fn kbd(self, k: impl Into<String>) -> MenuItem
pub fn danger(self, on: bool) -> MenuItem
pub fn disabled(self, on: bool) -> MenuItem
pub fn sub(self, items: Vec<MenuItem>) -> MenuItem
Trait Implementations§
impl StructuralPartialEq for MenuItem
Auto Trait Implementations§
impl Forget for MenuItem
impl Freeze for MenuItem
impl Move for MenuItem
impl RefUnwindSafe for MenuItem
impl Send for MenuItem
impl Sync for MenuItem
impl Unpin for MenuItem
impl UnsafeUnpin for MenuItem
impl UnwindSafe for MenuItem
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