From 8bc69450d07797f4720d2c004c48430a9a35a1a3 Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Tue, 28 Jun 2016 22:54:26 +0200 Subject: [PATCH] Include the new Book struct in a hashmap alongside the old representation --- src/book/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/book/mod.rs b/src/book/mod.rs index 2a999638..3aff03cd 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -20,12 +20,13 @@ use std::io; use std::io::Write; use std::io::ErrorKind; use std::process::Command; +use std::collections::HashMap; use {theme, parse, utils}; use renderer::{Renderer, HtmlHandlebars}; -pub struct MDBook { +pub struct MDBook<'a> { root: PathBuf, dest: PathBuf, src: PathBuf, @@ -36,12 +37,13 @@ pub struct MDBook { pub description: String, pub content: Vec, + books: HashMap<&'a str, Book>, renderer: Box, livereload: Option, } -impl MDBook { +impl<'a> MDBook<'a> { /// Create a new `MDBook` struct with root directory `root` /// /// Default directory paths: @@ -69,6 +71,7 @@ impl MDBook { description: String::new(), content: vec![], + books: HashMap::new(), renderer: Box::new(HtmlHandlebars::new()), livereload: None,