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
51
52
53
use crate::book::isbn::ISBN;
use crate::book::read::Read;
pub mod isbn;
pub mod read;
#[derive(Debug)]
pub struct Book {
pub title: String,
pub isbn: ISBN,
pub pages: u32,
pub read: Read
}
impl Book {
pub fn finish(&mut self) {
self.read = Read::Finished;
}
pub fn summary(&self) -> String {
format!("The book `{}` is a {} pages long read and is catalogued under the ISBN {}\n{}", self.title, self.pages, self.isbn, self.isbn.print_qr_code())
}
}