1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
pub mod sample;
use serde::{Deserialize, Serialize};
use crate::tag::Tag;
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct LatestListing {
pub chapters: Vec<LatestChapter>,
pub current_page: u16,
pub total_pages: u16,
}
impl LatestListing {
pub fn next_page(&self) -> Option<u16> {
if self.current_page < self.total_pages {
Some(self.current_page + 1)
} else {
None
}
}
}
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct LatestChapter {
pub title: String,
pub series: Option<String>,
pub(crate) permalink: String,
pub tags: Vec<Tag>,
}
impl LatestChapter {
pub fn path(&self) -> String {
format!("chapters/{}", self.permalink)
}
}