pub struct TerminalMenuStruct {
    pub items: Vec<TerminalMenuItem>,
    /* private fields */
}

Fields

items: Vec<TerminalMenuItem>

Implementations

Returns the name of the selected menu item.

Example
use terminal_menu::{menu, button, run, mut_menu};
let my_menu = menu(vec![
    button("a"),
    button("b"),
]);
run(&my_menu);
println!("selected item name: {}", mut_menu(&my_menu).selected_item_name()); //"a" or "b"

Returns the selected item as an index of the items vec.

Example
use terminal_menu::{menu, button, run, mut_menu};
let my_menu = menu(vec![
    button("a"),
    button("b"),
]);
run(&my_menu);
println!("selected item index: {}", mut_menu(&my_menu).selected_item_index()); // 0 or 1

Set the selected item with a name.

Example
use terminal_menu::{TerminalMenu, menu, button, mut_menu};
let my_menu: TerminalMenu = menu(vec![
    button("item"),
    button("other item")
]);
mut_menu(&my_menu).set_selected_item_with_name("item");

Set the selected item with an index of the items vec.

Example
use terminal_menu::{TerminalMenu, menu, button, mut_menu};
let my_menu: TerminalMenu = menu(vec![
    button("item"),
    button("other item")
]);
mut_menu(&my_menu).set_selected_item_with_index(1); //index 1 = other item

Returns the value of the specified scroll, list, or string item.

Example
use terminal_menu::{TerminalMenu, menu, scroll, run, mut_menu};
let my_menu: TerminalMenu = menu(vec![
    scroll("item", vec!["val1", "val2"])
]);
run(&my_menu);
println!("item value: {}", mut_menu(&my_menu).selection_value("item"));

Returns the value of the specified numeric item.

Example
use terminal_menu::{TerminalMenu, menu, scroll, run, numeric, mut_menu};
let my_menu: TerminalMenu = menu(vec![
    numeric("item", 0.0, None, None, None)
]);
run(&my_menu);
println!("item value: {}", mut_menu(&my_menu).numeric_value("item"));

Returns the specified submenu.

Example
use terminal_menu::{TerminalMenu, menu, run, submenu, scroll, mut_menu};
let my_menu: TerminalMenu = menu(vec![
    submenu("sub",vec![
        scroll("item", vec!["winnie", "the", "pooh"])
    ])
]);
run(&my_menu);
println!("{}", mut_menu(&my_menu).get_submenu("sub").selection_value("item"));

Returns the menu (or submenu) which was active on deactivation.

Returns true if menu was exited with ‘q’ or esc

Example
use terminal_menu::{menu, button, run, mut_menu};
let menu = menu(vec![
    button("button")
]);
run(&menu);

// true if esc, false if button
println!("{}", mut_menu(&menu).canceled());

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

Performs the conversion.

Performs the conversion.

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.