diff --git a/libimagentrymarkdown/src/html.rs b/libimagentrymarkdown/src/html.rs index 09038751..f9d251a8 100644 --- a/libimagentrymarkdown/src/html.rs +++ b/libimagentrymarkdown/src/html.rs @@ -53,4 +53,30 @@ pub mod iter { } + + /// Iterate over `(Entry, Result)` tuples + pub struct WithHtmlIterator> { + i: I + } + + impl> WithHtmlIterator { + + fn new(i: I) -> WithHtmlIterator { + WithHtmlIterator { i: i } + } + + } + + impl> Iterator for WithHtmlIterator { + type Item = (Entry, Result); + + fn next(&mut self) -> Option { + self.i.next().map(|entry| { + let html = to_html(&entry.get_content()[..]); + (entry, html) + }) + } + + } + }