pacenotes_installer\choices/
choice_list.rs1#[derive(Clone, Debug, PartialEq, Eq)]
3pub struct ChoiceOption {
4 pub key: String,
6 pub label: String,
8}
9
10#[derive(Clone, Debug, PartialEq, Eq)]
11pub struct ChoiceList {
12 pub category: &'static str,
14 pub options: Vec<ChoiceOption>,
15 pub selected: Option<usize>,
16}
17
18impl ChoiceList {
19 pub fn selected_key(&self) -> Option<&str> {
20 self.selected.map(|index| self.options[index].key.as_str())
21 }
22
23 pub fn is_satisfied(&self) -> bool {
25 self.options.is_empty() || self.selected.is_some()
26 }
27}