menu_genie 0.1.0

Multi-level terminal menu library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::MenuAction;
use std::fmt::Display;

pub struct MenuItem<'a> {
    pub prompt: &'a str,
    pub action: MenuAction,
    pub key: usize,
}

impl<'a> Display for MenuItem<'a> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}) {}", self.key, self.prompt)
    }
}