pub type AppResult = std::result::Result>; pub struct App<'a> { pub running: bool, pub tabs: Vec<&'a str>, pub tab_index: usize, } impl<'a> App<'a> { pub fn new() -> App<'a> { App { running: true, tabs: vec!["Tab1", "Tab2", "Tab3"], tab_index: 0, } } pub fn next_tab(&mut self) { self.tab_index = (self.tab_index + 1) % self.tabs.len(); } pub fn prev_tab(&mut self) { if self.tab_index > 0 { self.tab_index -= 1; } else { self.tab_index = self.tabs.len() - 1; } }}