pub struct MenuInstance<T: Copy> { /* private fields */ }
Expand description

An instance of a menu, with a selected entry. When a MenuInstance is rendered, the currently-selected entry is rendered using the Menu’s selected_info.

Implementations

Create a new MenuInstance with the first entry selected. Returns None if the Menu has 0 elements.

Create a new MenuInstance with the given index selected. Returns None if index >= menu.entries.len().

Returns a reference to the internal menu

Consumes the instance, returning its menu

Returns the current index

Sets the index, if the specified index < menu.entries.len()

Select the entry above the current selection, unless the first entry is currently selected.

Select the entry below the current selection, unless the last entry is currently selected.

Returns a copy of the currently selected entry’s value.

Feed input into the menu instance, possibly changing the selected entry, cancelling the menu, attempting to exit the program, or finalising the selection.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Update the cells in grid to describe how a type should be rendered. This mutably borrows self to allow the view to contain buffers/caches which are updated during rendering. Read more
Returns the size in cells of the rectangle containing a ui element. This allows for the implementation of decorator ui components that render a border around some inner element. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.