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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.