Skip to content

Commit 3e0dca5

Browse files
committed
Include the new Book struct in a hashmap alongside the old representation
1 parent d664618 commit 3e0dca5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/book/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ use std::io;
1818
use std::io::Write;
1919
use std::io::ErrorKind;
2020
use std::process::Command;
21+
use std::collections::HashMap;
2122

2223
use {theme, parse, utils};
2324
use renderer::{Renderer, HtmlHandlebars};
2425

2526

26-
pub struct MDBook {
27+
pub struct MDBook<'a> {
2728
root: PathBuf,
2829
dest: PathBuf,
2930
src: PathBuf,
@@ -33,12 +34,13 @@ pub struct MDBook {
3334
pub description: String,
3435

3536
pub content: Vec<BookItem>,
37+
books: HashMap<&'a str, Book>,
3638
renderer: Box<Renderer>,
3739

3840
livereload: Option<String>,
3941
}
4042

41-
impl MDBook {
43+
impl<'a> MDBook<'a> {
4244
/// Create a new `MDBook` struct with root directory `root`
4345
///
4446
/// - The default source directory is set to `root/src`
@@ -62,6 +64,7 @@ impl MDBook {
6264
description: String::new(),
6365

6466
content: vec![],
67+
books: HashMap::new(),
6568
renderer: Box::new(HtmlHandlebars::new()),
6669

6770
livereload: None,

0 commit comments

Comments
 (0)