fix code in doc
This commit is contained in:
parent
a050d9c4ad
commit
a32d170667
|
@ -39,17 +39,22 @@ impl MDBook {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a flat depth-first iterator over the elements of the book in the form of a tuple:
|
/// Returns a flat depth-first iterator over the elements of the book, it returns an [BookItem enum](bookitem.html):
|
||||||
/// `(section: String, bookitem: &BookItem)`
|
/// `(section: String, bookitem: &BookItem)`
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # extern crate mdbook;
|
/// # extern crate mdbook;
|
||||||
/// # use mdbook::MDBook;
|
/// # use mdbook::MDBook;
|
||||||
|
/// # use bookitem::BookItem;
|
||||||
/// # use std::path::Path;
|
/// # use std::path::Path;
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// # let mut book = MDBook::new(Path::new("mybook"));
|
/// # let mut book = MDBook::new(Path::new("mybook"));
|
||||||
/// for (section, element) in book.iter() {
|
/// for item in book.iter() {
|
||||||
/// println!("{} {}", section, element.name);
|
/// match item {
|
||||||
|
/// BookItem::Chapter(section, chapter) => {},
|
||||||
|
/// BookItem::Affix(chapter) => {},
|
||||||
|
/// BookItem::Spacer => {},
|
||||||
|
/// }
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// // would print something like this:
|
/// // would print something like this:
|
||||||
|
|
Loading…
Reference in New Issue