Parser::append
This commit is contained in:
parent
c0ae1a2229
commit
7839db8b06
28
src/roxy.rs
28
src/roxy.rs
|
|
@ -37,6 +37,10 @@ impl<'a> Parser<'a> {
|
|||
pub fn push<P: AsParse>(&mut self, parser: &'a mut P) {
|
||||
self.steps.push(parser.as_parse_mut());
|
||||
}
|
||||
|
||||
pub fn append(&mut self, parsers: &mut Vec<&'a mut dyn Parse>) {
|
||||
self.steps.append(parsers);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Parse for Parser<'a> {
|
||||
|
|
@ -141,3 +145,27 @@ impl Roxy {
|
|||
Self::mkdir_and_open(&output).and_then(|mut f| f.write_all(&buf))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Parse, Parser};
|
||||
|
||||
struct TestParser;
|
||||
impl TestParser {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for TestParser {
|
||||
fn parse(
|
||||
&mut self,
|
||||
path: &str,
|
||||
src: &[u8],
|
||||
dst: &mut Vec<u8>,
|
||||
) -> Result<(), crate::error::Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue