[][src]Struct mdbook::book::Chapter

pub struct Chapter {
    pub name: String,
    pub content: String,
    pub number: Option<SectionNumber>,
    pub sub_items: Vec<BookItem>,
    pub path: Option<PathBuf>,
    pub parent_names: Vec<String>,
}

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.

parent_names: Vec<String>

An ordered list of the names of each chapter above this one, in the hierarchy.

Implementations

impl Chapter[src]

pub fn new<P: Into<PathBuf>>(
    name: &str,
    content: String,
    path: P,
    parent_names: Vec<String>
) -> Chapter
[src]

Create a new chapter with the provided content.

pub fn new_draft(name: &str, parent_names: Vec<String>) -> Self[src]

Create a new draft chapter that is not attached to a source markdown file and has thus no content.

pub fn is_draft_chapter(&self) -> bool[src]

Check if the chapter is a draft chapter, meaning it has no path to a source markdown file

Trait Implementations

impl Clone for Chapter[src]

impl Debug for Chapter[src]

impl Default for Chapter[src]

impl<'de> Deserialize<'de> for Chapter[src]

impl Display for Chapter[src]

impl From<Chapter> for BookItem[src]

impl PartialEq<Chapter> for Chapter[src]

impl Serialize for Chapter[src]

impl StructuralPartialEq for Chapter[src]

Auto Trait Implementations

impl RefUnwindSafe for Chapter

impl Send for Chapter

impl Sync for Chapter

impl Unpin for Chapter

impl UnwindSafe for Chapter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,