#[derive(Debug)] pub struct ContentList { pub list: Vec, pub index: usize, } impl ContentList { pub fn new() -> Self { Self { list: Vec::new(), index: 0, } } pub fn next(&mut self) { if let Some(last) = self.list.len().checked_sub(1) { self.index = self.index.saturating_add(1).min(last); } } pub fn prev(&mut self) { self.index = self.index.saturating_sub(1); } } impl Default for ContentList { fn default() -> Self { Self::new() } }