Using trait objects seems good so far.
This commit is contained in:
parent
262bd3c061
commit
0cd3300444
@ -3,21 +3,17 @@ use nom::error::VerboseError;
|
|||||||
use nom::IResult;
|
use nom::IResult;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct NomContext
|
pub struct NomContext {
|
||||||
// where
|
pub fail_matcher: &dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>,
|
||||||
// F: for<'a> FnMut(&'a str) -> IResult<&'a str, &'a str, VerboseError<&'a str>>,
|
/// You can't have nested bolds or links in org-mode
|
||||||
// F: Clone,
|
|
||||||
{
|
|
||||||
// pub fail_matcher: F,
|
|
||||||
/// You can't have nested bolds in org-mode
|
|
||||||
pub can_match_bold: bool,
|
pub can_match_bold: bool,
|
||||||
pub can_match_link: bool,
|
pub can_match_link: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NomContext {
|
impl NomContext {
|
||||||
pub fn new(fail_matcher: F) -> Self {
|
pub fn new(fail_matcher: &dyn FnMut(&str) -> IResult<&str, &str, VerboseError<&str>>) -> Self {
|
||||||
NomContext {
|
NomContext {
|
||||||
// fail_matcher,
|
fail_matcher,
|
||||||
can_match_bold: true,
|
can_match_bold: true,
|
||||||
can_match_link: true,
|
can_match_link: true,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user