pub struct MenuItem {
pub menu: MenuId,
pub item: Item,
pub group: String,
pub order: i32,
pub when: String,
pub grey: bool,
pub checked: String,
pub radio: bool,
}Expand description
One contribution to a menu.
Fields§
§item: Item§group: StringItems of a group are shown together; groups are separated and
ordered by name (1_open, 2_preferences).
order: i32§when: StringWhere it applies; empty: everywhere.
grey: boolGreyed rather than hidden when when does not hold.
checked: StringWhen it shows ticked; empty: never.
radio: boolOne choice of a group (a dot when chosen) rather than a toggle (a
tick); its checked clause says whether it is the chosen one.
Implementations§
Source§impl MenuItem
impl MenuItem
pub fn command(menu: MenuId, group: &str, order: i32, id: CommandId) -> Self
pub fn list(menu: MenuId, group: &str, order: i32, name: &str) -> Self
pub fn args(self, args: Json) -> Self
Sourcepub fn label(self, label: &str) -> Self
pub fn label(self, label: &str) -> Self
Its own label (a command run with arguments: 50%), instead of
the command’s title.
pub fn when(self, when: &str, grey: bool) -> Self
pub fn checked(self, when: &str) -> Self
Trait Implementations§
impl StructuralPartialEq for MenuItem
Auto Trait Implementations§
impl Freeze 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