pub struct Menu { /* private fields */ }Expand description
The Menu to be shown in the command line interface.
Implementations§
Source§impl Menu
impl Menu
Sourcepub fn new(options: Vec<MenuOption>) -> Menu
pub fn new(options: Vec<MenuOption>) -> Menu
Creates a new interactable Menu.
§Examples
fn action_example() {}
let menu_option = MenuOption::new("Option example", action_example);
let menu = Menu::new(vec![menu_option]);You can use closures to easily use arguments in your functions.
fn action_example(msg: &str, val: f32) {
println!("action 3 with string {} and float {}", msg, val)
}
let menu_option = MenuOption::new("Option example", || action_example("example", 3.514));
let menu = Menu::new(vec![menu_option]);Auto Trait Implementations§
impl Freeze for Menu
impl !RefUnwindSafe for Menu
impl !Send for Menu
impl !Sync for Menu
impl Unpin for Menu
impl !UnwindSafe for Menu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more