pub struct ActionItem { /* private fields */ }
Expand description
An item that can be clicked on to perform an action
Implementations§
Source§impl ActionItem
impl ActionItem
Sourcepub fn new<S: Into<String>, H: MenuClickHandler>(
name: S,
handler: H,
) -> Result<Self, NulError>
pub fn new<S: Into<String>, H: MenuClickHandler>( name: S, handler: H, ) -> Result<Self, NulError>
Creates a new item
Returns an error if the name contains a null byte
Examples found in repository?
examples/menus.rs (line 22)
19 fn start() -> Result<Self, Self::Error> {
20 let plugins_submenu = Menu::new("Menu Test Plugin").unwrap();
21 plugins_submenu.add_child(CheckItem::new("Checkable 1", false, CheckHandler1).unwrap());
22 plugins_submenu.add_child(ActionItem::new("Action 1", ActionHandler1).unwrap());
23 plugins_submenu.add_to_plugins_menu();
24
25 // The menu needs to be part of the plugin struct, or it will immediately get dropped and
26 // will not appear
27 Ok(MenuPlugin {
28 _plugins_submenu: plugins_submenu,
29 })
30 }
Trait Implementations§
Source§impl Debug for ActionItem
impl Debug for ActionItem
Auto Trait Implementations§
impl !Freeze for ActionItem
impl !RefUnwindSafe for ActionItem
impl !Send for ActionItem
impl !Sync for ActionItem
impl Unpin for ActionItem
impl !UnwindSafe for ActionItem
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