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
50
pub mod sample;
use serde::{Deserialize, Serialize};
use crate::Tag;
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct Chapter {
pub title: String,
pub long_title: String,
pub(crate) permalink: String,
pub tags: Vec<Tag>,
pub pages: Vec<ChapterPage>,
pub released_on: String,
pub added_on: String,
}
impl Chapter {
pub fn path(&self) -> String {
format!("chapters/{}", self.permalink)
}
}
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct ChapterPage {
#[serde(rename(deserialize = "name"))]
pub title: String,
pub(crate) url: String,
}
impl ChapterPage {
pub fn path(&self) -> String {
self.url.clone()
}
}