use crate::util::md_tools::md_print::*;
use pulldown_cmark::Event;
use std::iter::Peekable;
pub(crate) struct MdSplitter<'a, I>
where
I: Iterator<Item = Event<'a>>,
{
events: Peekable<I>,
}
impl<'a, I> MdSplitter<'a, I>
where
I: Iterator<Item = Event<'a>>,
{
pub fn new(events: I) -> Self {
Self {
events: events.peekable(),
}
}
}
impl<'a, I> Iterator for MdSplitter<'a, I>
where
I: Iterator<Item = Event<'a>>,
{
type Item = MdPartition<'a>;
fn next(&mut self) -> Option<Self::Item> {
MdPartition::new(&mut self.events)
}
}