Lifetime issue.

This commit is contained in:
Tom Alexander 2022-07-16 20:45:38 -04:00
parent c67de70363
commit 5c39a6a7bf
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 6 additions and 3 deletions

View File

@ -41,7 +41,7 @@ pub trait ParserWithContext {
fn bind_context<'a, 'c>(
&mut self,
context: &mut NomContext<'c, &'a str, &'a str, VerboseError<&'a str>>,
) -> Box<dyn FnMut(&'a str) -> IResult<&'a str, &'a str, VerboseError<&'a str>>>;
) -> Box<dyn FnMut(&'a str) -> IResult<&'a str, TextElement<'a>, VerboseError<&'a str>>>;
}
impl<F> ParserWithContext for F
@ -55,10 +55,13 @@ where
&mut self,
context: &mut NomContext<'c, &str, &str, VerboseError<&str>>,
) -> Box<
(dyn for<'a> FnMut(&'a str) -> Result<(&'a str, &'a str), nom::Err<VerboseError<&'a str>>>
(dyn for<'a> FnMut(
&'a str,
)
-> Result<(&'a str, TextElement<'a>), nom::Err<VerboseError<&'a str>>>
+ 'static),
> {
Box::new(|i| self.call_mut((i, context)))
Box::new(|i| self(i, context))
}
}