From a32d1706671dba3cdb12cb9d18bd90e891da9861 Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Fri, 11 Sep 2015 21:01:34 +0200 Subject: [PATCH] fix code in doc --- src/book/mdbook.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/book/mdbook.rs b/src/book/mdbook.rs index 6fda6205..1f0e2339 100644 --- a/src/book/mdbook.rs +++ b/src/book/mdbook.rs @@ -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)` /// /// ```no_run /// # extern crate mdbook; /// # use mdbook::MDBook; + /// # use bookitem::BookItem; /// # use std::path::Path; /// # fn main() { /// # let mut book = MDBook::new(Path::new("mybook")); - /// for (section, element) in book.iter() { - /// println!("{} {}", section, element.name); + /// for item in book.iter() { + /// match item { + /// BookItem::Chapter(section, chapter) => {}, + /// BookItem::Affix(chapter) => {}, + /// BookItem::Spacer => {}, + /// } /// } /// /// // would print something like this: