Function eprompt::select

source ·
pub fn select<'a, T: Display>(
    prompt: &str,
    opts: &'a [T]
) -> Result<(usize, &'a T)>
Expand description

Gets single user choice from opts and returns the selected index and reference to the selected option

use eprompt::*;
let chosen: (usize, &i32) = select("Choose an option:", &[1, 2, 3]).unwrap();