aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.rs
diff options
context:
space:
mode:
authorsam-anthony <samanthony6@protonmail.com>2022-02-05 21:42:28 -0330
committersam-anthony <samanthony6@protonmail.com>2022-02-05 21:42:28 -0330
commitffffee2ac77c88ea0219b1b0e39e3988ed918319 (patch)
treef980f16f7ecc3176e36f7ea152122f11e1209486 /src/app.rs
parentfd512094eb013e512c1faa98eb168bbc0b23859b (diff)
downloadvolute-ffffee2ac77c88ea0219b1b0e39e3988ed918319.zip
impl Iterator for Row for building input table
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/app.rs b/src/app.rs
index 25002bd..92f89c0 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -7,14 +7,18 @@ pub struct App {
pub tab_index: usize,
tab_titles: [&'static str; 2],
- pub rows: Vec<Row>,
- pub selected_row: usize,
- pub selected_column: InputParam,
+ rows: Vec<Row>,
+ selected_row: usize,
+ selected_column: InputParam,
pub input_mode: InputMode,
}
impl App {
+ pub fn rows(&self) -> &Vec<Row> {
+ &self.rows
+ }
+
pub fn tab_titles(&self) -> &[&str] {
&self.tab_titles
}
@@ -68,6 +72,22 @@ impl App {
}
}
}
+
+ pub fn selected_input_param(&self) -> &InputParam {
+ match self.selected_column {
+ InputParam::Rpm(_) => &self.rows[self.selected_row].rpm,
+ InputParam::Ve(_) => &self.rows[self.selected_row].ve,
+ InputParam::Map(_) => &self.rows[self.selected_row].map,
+ }
+ }
+
+ pub fn selected_input_param_mut(&mut self) -> &mut InputParam {
+ match self.selected_column {
+ InputParam::Rpm(_) => &mut self.rows[self.selected_row].rpm,
+ InputParam::Ve(_) => &mut self.rows[self.selected_row].ve,
+ InputParam::Map(_) => &mut self.rows[self.selected_row].map,
+ }
+ }
}
impl Default for App {