Skip to main content

collect_context_items

Function collect_context_items 

Source
pub fn collect_context_items(
    include_defaults: bool,
    caps: ContextMenuCaps,
    hook_rows: Vec<Vec<ContextMenuItem>>,
) -> Vec<ContextMenuItem>
Expand description

Merges defaults with hook-contributed rows.

  • When include_defaults is false, only hook rows are used.
  • Hook rows append in order after the defaults.
  • A hook row whose id matches a default (or an earlier hook row) replaces it in place, keeping the original position.
  • The trailing divider on the defaults block is dropped when no hook rows follow, so a defaults-only menu has no stray separator.