mdBook/src/book/bookconfig.rs

44 lines
859 B
Rust
Raw Normal View History

use std::path::{Path, PathBuf};
2015-07-17 00:20:36 +08:00
#[derive(Debug, Clone)]
2015-07-17 00:20:36 +08:00
pub struct BookConfig {
pub title: String,
pub author: String,
2015-07-17 00:20:36 +08:00
dest: PathBuf,
src: PathBuf,
indent_spaces: i32,
2015-07-17 00:20:36 +08:00
multilingual: bool,
}
impl BookConfig {
pub fn new() -> Self {
BookConfig {
title: String::new(),
author: String::new(),
2015-07-17 00:20:36 +08:00
dest: PathBuf::from("book"),
src: PathBuf::from("src"),
indent_spaces: 4,
2015-07-17 00:20:36 +08:00
multilingual: false,
}
}
pub fn dest(&self) -> &Path {
&self.dest
2015-07-17 00:20:36 +08:00
}
pub fn set_dest(&mut self, dest: &Path) -> &mut Self {
self.dest = dest.to_owned();
2015-07-17 00:20:36 +08:00
self
}
pub fn src(&self) -> &Path {
&self.src
2015-07-17 00:20:36 +08:00
}
pub fn set_src(&mut self, src: &Path) -> &mut Self {
self.src = src.to_owned();
self
}
2015-07-17 00:20:36 +08:00
}