pub struct MenuItems(/* private fields */);Expand description
The set of menu items a board enables.
MenuItem::Status and every Back entry are always present
regardless of how the set was built.
Implementations§
Source§impl MenuItems
impl MenuItems
Sourcepub const fn without(self, item: MenuItem) -> Self
pub const fn without(self, item: MenuItem) -> Self
Disable one item.
The counterpart to with for boards that start from
all and name what they cannot do, which is the
shorter list on most hardware. Removing every entry of a level
removes the way into it too — see
level_is_empty — so a board need not
also remember to disable the submenu that led there.
pub const fn contains(self, item: MenuItem) -> bool
Sourcepub const fn len(self) -> u32
pub const fn len(self) -> u32
Number of enabled items across the whole tree. Always at least one.
pub const fn is_empty(self) -> bool
Sourcepub fn level_is_empty(self, level: Level) -> bool
pub fn level_is_empty(self, level: Level) -> bool
Whether a level has anything worth entering: any enabled entry that is not its own Back.
A submenu whose entries are all disabled is not shown at all, rather than opening onto a list containing only Back.
Sourcepub fn entries(self, level: Level) -> impl Iterator<Item = MenuItem>
pub fn entries(self, level: Level) -> impl Iterator<Item = MenuItem>
The enabled entries of one level, in navigation order.
This is what a renderer draws a list from, so it and
step must agree about what is on screen.
Sourcepub fn first_after_back(self, level: Level) -> MenuItem
pub fn first_after_back(self, level: Level) -> MenuItem
The entry a freshly entered level should highlight: the first one after Back.
Highlighting the exit of a screen the user just asked to enter
would waste the press that got them there. A level with nothing
but Back falls back to it, though level_is_empty
means such a level is never entered.
Trait Implementations§
impl Copy for MenuItems
impl Eq for MenuItems
impl StructuralPartialEq for MenuItems
Auto Trait Implementations§
impl Freeze for MenuItems
impl RefUnwindSafe for MenuItems
impl Send for MenuItems
impl Sync for MenuItems
impl Unpin for MenuItems
impl UnwindSafe for MenuItems
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)