[][src]Struct prototty_common::Menu

pub struct Menu<T: Copy> {
    pub entries: Vec<MenuEntry<T>>,
    pub size: Size,
    pub selected_info: TextInfo,
    pub normal_info: TextInfo,
}

A list of MenuEntrys, 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.

Menus (MenuEntrys 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: Sizeselected_info: TextInfonormal_info: TextInfo

Methods

impl<T: Copy> Menu<T>[src]

pub fn new<S, V>(e: Vec<(S, T)>, size: V) -> Self where
    S: Into<String>,
    V: Into<Size>, 
[src]

Create a new menu.

pub fn smallest<S>(e: Vec<(S, T)>) -> Self where
    S: Into<String>, 
[src]

Create a new menu, occupying the smallest amount of space required to fit all entries.

Trait Implementations

impl<T: Clone + Copy> Clone for Menu<T>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Debug + Copy> Debug for Menu<T>[src]

Auto Trait Implementations

impl<T> Send for Menu<T> where
    T: Send

impl<T> Sync for Menu<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]