cancel/
cancel.rs

1///
2/// Explains how menus are cancelled and how to detect cancellation.
3///
4
5fn main() {
6    use terminal_menu::{menu, label, button, run, mut_menu};
7    let menu = menu(vec![
8        label("press the button or hit 'q' or esc!"),
9        button("button")
10    ]);
11    run(&menu);
12
13    // true if exited with 'q' or esc, false if button was pressed
14    println!("{}", mut_menu(&menu).canceled());
15}