pub struct MenuItem { /* private fields */ }
Expand description
A data structure representing a line-item in a menu
The recommended way of constructing these is to use the menu_item!
macro
though the output will be the same
§Example
let menu_item = MenuItem::new("A Menu Item".to_string())
.visible_at_rest(true)
.at_rest_position(1);
// is the same as
menu_item!("A Menu Item", true, 1);
Implementations§
Source§impl MenuItem
impl MenuItem
Sourcepub fn visible_at_rest(self, visible: bool) -> Self
pub fn visible_at_rest(self, visible: bool) -> Self
Set whether a MenuItem
is visible when no search is showing
Sourcepub fn at_rest_position(self, position: usize) -> Self
pub fn at_rest_position(self, position: usize) -> Self
Set a MenuItem
’s resting position in the no search menu
Note: Won’t have any effect if visible_at_rest is false
Sourcepub fn add_alternative_match(self, new_matches: Vec<String>) -> Self
pub fn add_alternative_match(self, new_matches: Vec<String>) -> Self
Set alternative matches for a MenuItem
. These are strings that this item will
match to when searching - in addition to the visible_name
Trait Implementations§
Source§impl Ord for MenuItem
impl Ord for MenuItem
Source§impl PartialOrd for MenuItem
impl PartialOrd for MenuItem
impl Eq for MenuItem
impl StructuralPartialEq for MenuItem
Auto Trait Implementations§
impl Freeze for MenuItem
impl RefUnwindSafe for MenuItem
impl Send for MenuItem
impl Sync for MenuItem
impl Unpin for MenuItem
impl UnwindSafe for MenuItem
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