Parse::as_dyn
This commit is contained in:
parent
4d50a1d287
commit
36530dc69a
12
src/roxy.rs
12
src/roxy.rs
|
@ -8,16 +8,16 @@ use crate::error::Error;
|
|||
|
||||
pub trait Parse {
|
||||
fn parse(&mut self, path: &str, src: &[u8], dst: &mut Vec<u8>) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
impl<'a, P: Parse + 'static> Into<Box<dyn Parse>> for (P,) {
|
||||
fn into(self) -> Box<dyn Parse> {
|
||||
Box::new(self.0)
|
||||
fn as_dyn(&self) -> &dyn Parse where Self: Sized {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AndThenParser<P> {
|
||||
fn and_then(&mut self, parser: P) -> &Self;
|
||||
impl<P: Parse + 'static> Into<Box<dyn Parse>> for (P,) {
|
||||
fn into(self) -> Box<dyn Parse> {
|
||||
Box::new(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Parser<'a> {
|
||||
|
|
Loading…
Reference in a new issue