Struct mdbook::book::Book
[−]
[src]
pub struct Book { pub sections: Vec<BookItem>, // some fields omitted }
A dumb tree structure representing a book.
For the moment a book is just a collection of BookItems
which are
accessible by either iterating (immutably) over the book with iter()
, or
recursively applying a closure to each section to mutate the chapters, using
for_each_mut()
.
Fields
sections: Vec<BookItem>
The sections in this book.
Methods
impl Book
[src]
pub fn new() -> Self
[src]
Create an empty book.
ⓘImportant traits for BookItems<'a>pub fn iter(&self) -> BookItems
[src]
Get a depth-first iterator over the items in the book.
pub fn for_each_mut<F>(&mut self, func: F) where
F: FnMut(&mut BookItem),
[src]
F: FnMut(&mut BookItem),
Recursively apply a closure to each item in the book, allowing you to mutate them.
Note
Unlike the iter()
method, this requires a closure instead of returning
an iterator. This is because using iterators can possibly allow you
to have iterator invalidation errors.
ⓘImportant traits for &'a mut Wpub fn push_item<I: Into<BookItem>>(&mut self, item: I) -> &mut Self
[src]
Append a BookItem
to the Book
.
Trait Implementations
impl Debug for Book
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for Book
[src]
fn clone(&self) -> Book
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more