async/async.rs
1///
2/// Use menus asynchronously.
3///
4
5fn main() {
6 use terminal_menu::{menu, label, button, activate, wait_for_exit};
7 let menu = menu(vec![
8 label("do work when menu open!"),
9 button("get me out of here!")
10 ]);
11
12 // like run but doesn't block
13 activate(&menu);
14
15 // do stuff
16 let mut num: usize = 1;
17 for i in 2..10 {
18 num *= i;
19 }
20
21 wait_for_exit(&menu);
22 println!("{}", num);
23}