Skip to content

Commit

Permalink
implement remove
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Oct 11, 2022
1 parent 47d825c commit 0efd231
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 54 deletions.
11 changes: 8 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ impl Menu {
}
}

/// ## Panics
///
/// - If `item` has already been removed
/// - If `item` wasn't previously [append](Menu::append)ed to this menu
pub fn remove(&self, item: &dyn MenuItem) {
self.0.remove(item)
}
Expand Down Expand Up @@ -218,7 +222,7 @@ impl Menu {
}
}

#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Submenu(platform_impl::Submenu);

unsafe impl MenuItem for Submenu {
Expand Down Expand Up @@ -303,7 +307,7 @@ impl Submenu {
}
}

#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct TextMenuItem(platform_impl::TextMenuItem);

unsafe impl MenuItem for TextMenuItem {
Expand Down Expand Up @@ -355,7 +359,7 @@ impl TextMenuItem {
}
}

#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct CheckMenuItem(platform_impl::CheckMenuItem);

unsafe impl MenuItem for CheckMenuItem {
Expand Down Expand Up @@ -418,6 +422,7 @@ impl CheckMenuItem {
mod internal {
//! **DO NOT USE:**. This is meant for internal usage inside the crate.
#[derive(Debug)]
pub enum MenuItemType {
Submenu,
Text,
Expand Down
Loading

0 comments on commit 0efd231

Please sign in to comment.