aboutsummaryrefslogtreecommitdiff
path: root/src/list.rs
blob: 669d1af4fbd38c093799ad358e8e5e05e6e431b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#[derive(Debug)]
pub struct ContentList {
    pub index: usize
}

impl ContentList {
    pub fn new() -> Self {
        ContentList {
            index: 0
        }
    }

    // Go to next item in list
    pub fn next(&mut self) {
        self.index += 1;
    }

    /// Go to previous item in list
    pub fn prev(&mut self) {
        if self.index != 0 {
            self.index -= 1;
        }
    }
}