1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
use super::*;

pub struct Raw(pub Vec<Element>);

impl Processor for Raw {
    fn process(&mut self, e: Element) -> Result<(), failure::Error> {
        self.0.push(e);
        Ok(())
    }
}

impl Raw {
    pub fn new() -> Self {
        Raw(Vec::new())
    }
    pub fn run<P:Processor>(&self, p: &mut P) -> Result<(), failure::Error> {
        for i in self.0.iter() {
            p.process(i.clone())?
        }
        p.finish()
    }
}