MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / replace_children

Function replace_children

desktop/src/window/mac/menu.rs:103–111  ·  view source on GitHub ↗
(menu: T, new_items: Vec<MenuItemKind>)

Source from the content-addressed store, hash-verified

101}
102
103fn replace_children<'a, T: Into<MenuContainer<'a>>>(menu: T, new_items: Vec<MenuItemKind>) {
104 let menu: MenuContainer = menu.into();
105 let items = menu.items();
106 for item in items.iter() {
107 menu.remove(menu_item_kind_to_dyn(item)).unwrap();
108 }
109 let items = new_items.iter().map(menu_item_kind_to_dyn).collect::<Vec<&dyn IsMenuItem>>();
110 menu.append_items(items.as_ref()).unwrap();
111}
112
113enum MenuContainer<'a> {
114 Menu(&'a MudaMenu),

Callers 1

updateMethod · 0.85

Calls 6

menu_item_kind_to_dynFunction · 0.85
itemsMethod · 0.80
append_itemsMethod · 0.80
iterMethod · 0.45
removeMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected