diff --git a/src/roxy.rs b/src/roxy.rs
index 496d010..80dc942 100644
--- a/src/roxy.rs
+++ b/src/roxy.rs
@@ -12,21 +12,21 @@ pub trait AndThenParser
{
fn and_then(&mut self, parser: P) -> &Self;
}
-pub struct Parser {
- steps: Vec>,
+pub struct Parser<'a> {
+ steps: Vec<&'a mut dyn Parse>,
}
-impl Parser {
+impl<'a> Parser<'a> {
pub fn new() -> Self {
Parser { steps: Vec::new() }
}
- pub fn push(&mut self, parser: P) {
- self.steps.push(Box::new(parser));
+ pub fn push(&mut self, parser: &'a mut P) {
+ self.steps.push(parser);
}
}
-impl Parse for Parser {
+impl<'a> Parse for Parser<'a> {
fn parse(&mut self, path: &str, src: &[u8], dst: &mut Vec) -> std::io::Result<()> {
let mut buf_1 = Vec::from(src);
let mut buf_2 = Vec::from(dst.as_slice());