Struct mdbook::book::Chapter [−][src]
pub struct Chapter {
pub name: String,
pub content: String,
pub number: Option<SectionNumber>,
pub sub_items: Vec<BookItem>,
pub path: Option<PathBuf>,
pub source_path: Option<PathBuf>,
pub parent_names: Vec<String>,
}
Expand description
The representation of a “chapter”, usually mapping to a single file on disk however it may contain multiple sub-chapters.
Fields
name: String
The chapter’s name.
content: String
The chapter’s contents.
number: Option<SectionNumber>
The chapter’s section number, if it has one.
sub_items: Vec<BookItem>
Nested items.
path: Option<PathBuf>
The chapter’s location, relative to the SUMMARY.md
file.
source_path: Option<PathBuf>
The chapter’s source file, relative to the SUMMARY.md
file.
parent_names: Vec<String>
An ordered list of the names of each chapter above this one in the hierarchy.
Implementations
Create a new chapter with the provided content.
Create a new draft chapter that is not attached to a source markdown file (and thus has no content).
Check if the chapter is a draft chapter, meaning it has no path to a source markdown file.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Chapter
impl UnwindSafe for Chapter
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self