From 3519c76c61bbc95ff8535bc1f7f6fd1810697bb8 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 17 Jul 2022 17:29:24 -0400 Subject: [PATCH] Lifetime issue. --- src/parser/nom_context.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/parser/nom_context.rs b/src/parser/nom_context.rs index 7b302af1..501a1abe 100644 --- a/src/parser/nom_context.rs +++ b/src/parser/nom_context.rs @@ -36,4 +36,21 @@ where can_match_link: true, } } + + pub fn with_additional_fail_matcher( + self, + additional_fail_matcher: G, + ) -> NomContext FnMut(&'b str) -> IResult<&'b str, &'b str, VerboseError<&'b str>>)> + where + G: for<'b> FnMut(&'b str) -> IResult<&'b str, &'b str, VerboseError<&'b str>>, + G: Clone, + // O: for<'b> FnMut(&'b str) -> IResult<&'b str, &'b str, VerboseError<&'b str>>, + // O: Clone, + { + NomContext { + fail_matcher: alt((additional_fail_matcher, self.fail_matcher)), + can_match_bold: self.can_match_bold, + can_match_link: self.can_match_link, + } + } }