pub struct Item {
pub id: String,
pub label: String,
pub accelerator: Option<String>,
pub enabled: bool,
pub disabled_reason: Option<String>,
pub checked: Option<bool>,
}Expand description
A clickable item. Activating it delivers id.
Fields§
§id: StringUnique in the bar; the command id for items built from commands (file.save).
label: String§accelerator: Option<String>Portable shortcut (Mod+Shift+S, alternatives separated by /). Only menu-safe ones
become native key equivalents (Chord::is_menu_safe); the rest stay the app’s window
shortcuts.
enabled: bool§disabled_reason: Option<String>Why the item is disabled (shown on hover where the renderer can).
checked: Option<bool>Some makes it a check item.
Implementations§
Source§impl Item
impl Item
pub fn new(id: impl Into<String>, label: impl Into<String>) -> Self
pub fn accelerator(self, text: impl Into<String>) -> Self
pub fn enabled(self, enabled: bool) -> Self
pub fn checked(self, checked: bool) -> Self
The native key equivalent, when the accelerator has one (menu_chord).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Item
impl<'de> Deserialize<'de> for Item
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Item
impl StructuralPartialEq for Item
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnsafeUnpin for Item
impl UnwindSafe for Item
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