pub enum MenuItem {
Action {
label: String,
action: String,
disabled: bool,
shortcut: Option<String>,
},
Checkbox {
label: String,
action: String,
checked: bool,
disabled: bool,
},
Separator,
Submenu {
label: String,
items: Vec<Self>,
disabled: bool,
},
}Expand description
Menu item variant.
Variants§
Implementations§
Source§impl MenuItem
impl MenuItem
Sourcepub fn action(label: impl Into<String>, action: impl Into<String>) -> Self
pub fn action(label: impl Into<String>, action: impl Into<String>) -> Self
Create a new action item.
Sourcepub fn checkbox(
label: impl Into<String>,
action: impl Into<String>,
checked: bool,
) -> Self
pub fn checkbox( label: impl Into<String>, action: impl Into<String>, checked: bool, ) -> Self
Create a new checkbox item.
Create a submenu.
Sourcepub fn is_selectable(&self) -> bool
pub fn is_selectable(&self) -> bool
Check if this item is selectable (not separator, not disabled).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MenuItem
impl<'de> Deserialize<'de> for MenuItem
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
Auto Trait Implementations§
impl Freeze for MenuItem
impl RefUnwindSafe for MenuItem
impl Send for MenuItem
impl Sync for MenuItem
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more