use nom::branch::alt; use nom::error::VerboseError; use nom::IResult; pub struct NomContext<'a> { pub fail_matcher: &'a mut dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>, /// You can't have nested bolds or links in org-mode pub can_match_bold: bool, pub can_match_link: bool, } impl<'a> NomContext<'a> { pub fn new( fail_matcher: &'a mut dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>, ) -> Self { NomContext { fail_matcher, can_match_bold: true, can_match_link: true, } } }