Skip to content

Help typing a not-so-generic combinator #416

Answered by epage
basro asked this question in Q&A
Discussion options

You must be logged in to vote
fn example_combinator(prefix: &'static str) -> impl Parser<&str, &str, ContextError>` // What types go here?
{
  (prefix, take_while(0.., '_')).recognize()
}

With Parser<I, O, E>

  • I maps to the input to your Fn
  • O maps to the first (or only) parameter for PResult
  • E maps to the second parameter to PResult which is defaulted to be ContextError

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by basro
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants