mdBook/src/book/bookconfig.rs

54 lines
1.1 KiB
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 {
title: String,
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
}
pub fn set_title(&mut self, title: &str) -> &mut Self {
self.title = title.to_owned();
self
}
pub fn set_author(&mut self, author: &str) -> &mut Self {
self.author = author.to_owned();
2015-07-17 00:20:36 +08:00
self
}
}