[−][src]Struct prototty::Menu
A list of MenuEntry
s, in the order they appear when rendered,
with a description of how the text of the selected and normal
(ie. not selected) entries should be rendered.
Menu
s (MenuEntry
s rather) own their value, and remain in
scope after a value has been chosen (by running the menu).
A copy of a MenuEntry
's value is returned by MenuRunner::run_menu
.
Note that a Menu
doesn't contain information about the current
selection. When a Menu
is rendered, all its entries use
normal_info
when rendering. To combine a Menu
with selection
state, use a MenuInstance
.
Fields
entries: Vec<MenuEntry<T>>
size: Size
selected_info: TextInfo
normal_info: TextInfo
Methods
impl<T> Menu<T> where
T: Copy,
[src]
T: Copy,
pub fn new<S, V>(e: Vec<(S, T)>, size: V) -> Menu<T> where
S: Into<String>,
V: Into<Size>,
[src]
S: Into<String>,
V: Into<Size>,
Create a new menu.
pub fn smallest<S>(e: Vec<(S, T)>) -> Menu<T> where
S: Into<String>,
[src]
S: Into<String>,
Create a new menu, occupying the smallest amount of space required to fit all entries.
Trait Implementations
impl<T> Debug for Menu<T> where
T: Copy + Debug,
[src]
T: Copy + Debug,
impl<T> Clone for Menu<T> where
T: Copy + Clone,
[src]
T: Copy + Clone,
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,