epubparse/types.rs
1use serde::{Deserialize, Serialize};
2
3/// A text-only book
4#[derive(PartialEq, Eq, Debug, Serialize, Deserialize)]
5pub struct Book {
6 pub title: String,
7 pub author: Option<String>,
8 pub preface_content: String,
9 pub chapters: Vec<Chapter>,
10}
11
12/// A chapter within a book
13///
14/// A chapter has a title and content
15/// The content is sequentially made up of
16/// 1. text (may be empty)
17/// 2. a sequence of subchapters (may be zero)
18#[derive(PartialEq, Eq, Debug, Serialize, Deserialize)]
19pub struct Chapter {
20 pub title: String,
21 pub text: String,
22 pub subchapters: Vec<Chapter>,
23}