pub struct MenuBar {
pub menus: Vec<Menu>,
}Expand description
A minimal, data-only menu model intended to power:
- future menubar rendering,
- context menus,
- command palette “breadcrumbs”.
This keeps menu structures derived from commands (ADR 0023) and avoids duplicating enablement logic in widget code.
Fields§
Implementations§
Source§impl MenuBar
impl MenuBar
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
Normalize the menu structure for display across menu surfaces.
This is a best-effort “shape cleanup” pass intended to prevent drift between:
- OS menubars (runner mappings),
- in-window menubars (overlay renderers),
- other menu-like surfaces that derive from
MenuBar.
Current normalization rules:
- remove leading separators,
- collapse duplicate separators,
- remove trailing separators,
- recursively drop empty submenus (after normalizing their children).
Note: this does not apply enable/disable gating; that is handled by
WindowCommandGatingSnapshot and surface-specific policies.
pub fn normalized(self) -> Self
Source§impl MenuBar
impl MenuBar
pub fn from_bytes(bytes: &[u8]) -> Result<Self, MenuBarError>
pub fn from_v1(file: MenuBarFileV1) -> Result<Self, MenuBarError>
pub fn from_v2(file: MenuBarFileV2) -> Result<Self, MenuBarError>
Trait Implementations§
impl Eq for MenuBar
impl StructuralPartialEq for MenuBar
Auto Trait Implementations§
impl Freeze for MenuBar
impl RefUnwindSafe for MenuBar
impl Send for MenuBar
impl Sync for MenuBar
impl Unpin for MenuBar
impl UnsafeUnpin for MenuBar
impl UnwindSafe for MenuBar
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