markdown_linkify/
aggregation.rs1use std::vec::IntoIter;
2
3use pulldown_cmark::Event;
4
5use crate::link::Link;
6
7#[derive(Debug)]
8pub enum Aggregation<'a> {
9 Event(Event<'a>),
10 Bag(Vec<Event<'a>>),
11 Link(Link<'a>),
12}
13
14impl<'a> IntoIterator for Aggregation<'a> {
15 type Item = Event<'a>;
16
17 type IntoIter = IntoIter<Event<'a>>;
18
19 fn into_iter(self) -> Self::IntoIter {
20 match self {
21 Aggregation::Event(e) => vec![e].into_iter(),
22 Aggregation::Bag(vec) => vec.into_iter(),
23 Aggregation::Link(l) => l.into_iter(),
24 }
25 }
26}