From 1e60d6b53c03a90673e602334a2c052d5ae4b193 Mon Sep 17 00:00:00 2001 From: Michael Bryan Date: Sat, 24 Jun 2017 22:47:03 +0800 Subject: [PATCH] Created a new Loader module and some stubs --- src/lib.rs | 1 + src/loader/mod.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/loader/mod.rs diff --git a/src/lib.rs b/src/lib.rs index aab5ca5d..16ac0ed7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,6 +89,7 @@ mod parse; pub mod renderer; pub mod theme; pub mod utils; +pub mod loader; pub use book::MDBook; pub use book::BookItem; diff --git a/src/loader/mod.rs b/src/loader/mod.rs new file mode 100644 index 00000000..eff46441 --- /dev/null +++ b/src/loader/mod.rs @@ -0,0 +1,29 @@ +//! Functionality for loading the internal book representation from disk. + +#![deny(missing_docs)] + +use std::path::{Path, PathBuf}; +use std::error::Error; + + +/// The object in charge of parsing the source directory into a usable +/// `Book` struct. +#[derive(Debug, Clone, PartialEq)] +pub struct Loader { + source_directory: PathBuf, +} + +impl Loader { + /// Create a new loader which uses the provided source directory. + pub fn new>(source_directory: P) -> Loader { + Loader { source_directory: source_directory.as_ref().to_path_buf() } + } + + /// Parse the `SUMMARY.md` file. + pub fn parse_summary(&self) -> Result> { + unimplemented!() + } +} + +/// The parsed `SUMMARY.md`, specifying how the book should be laid out. +pub struct Summary; \ No newline at end of file