Fix no-default-features build

This commit is contained in:
Boris-Chengbiao Zhou 2016-05-08 21:51:34 +02:00
parent cfcf6d952f
commit 9b1e224680
2 changed files with 4 additions and 2 deletions

View File

@ -2,13 +2,14 @@
extern crate mdbook; extern crate mdbook;
#[macro_use] #[macro_use]
extern crate clap; extern crate clap;
extern crate crossbeam;
// Dependencies for the Watch feature // Dependencies for the Watch feature
#[cfg(feature = "watch")] #[cfg(feature = "watch")]
extern crate notify; extern crate notify;
#[cfg(feature = "watch")] #[cfg(feature = "watch")]
extern crate time; extern crate time;
#[cfg(feature = "watch")]
extern crate crossbeam;
// Dependencies for the Serve feature // Dependencies for the Serve feature
#[cfg(feature = "serve")] #[cfg(feature = "serve")]
@ -269,6 +270,7 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf {
// Calls the closure when a book source file is changed. This is blocking! // Calls the closure when a book source file is changed. This is blocking!
#[cfg(feature = "watch")]
fn trigger_on_change<F>(book: &mut MDBook, closure: F) -> () fn trigger_on_change<F>(book: &mut MDBook, closure: F) -> ()
where F: Fn(notify::Event, &mut MDBook) -> () where F: Fn(notify::Event, &mut MDBook) -> ()
{ {

View File

@ -28,7 +28,6 @@ pub struct MDBook {
pub content: Vec<BookItem>, pub content: Vec<BookItem>,
renderer: Box<Renderer>, renderer: Box<Renderer>,
#[cfg(feature = "serve")]
livereload: Option<String>, livereload: Option<String>,
} }
@ -57,6 +56,7 @@ impl MDBook {
content: vec![], content: vec![],
renderer: Box::new(HtmlHandlebars::new()), renderer: Box::new(HtmlHandlebars::new()),
livereload: None, livereload: None,
} }
} }