Starts a lookahead transformation provided by f from the Box<ParserState>. It returns
Ok with the current Box<ParserState> if f also returns an Ok, or Err with the current
Box<ParserState> otherwise. If is_positive is false, it swaps the Ok and Err
together, negating the Result.

Evaluates the result of closure f and pushes the span of the input consumed from before
f is called to after f is called to the stack. Returns Ok(Box<ParserState>) if f is
called successfully, or Err(Box<ParserState>) otherwise.

enumRule {}
letinput="ab";
letmutstate: Box<pest::ParserState<Rule>>=pest::ParserState::new(input);
letmutresult=state.restore_on_err(|state|state.stack_push(|state|state.match_string("a")).and_then(|state|state.match_string("a"))
);
assert!(result.is_err());
// Since the the rule doesn't match, the "a" pushed to the stack will be removed.letcatch_panic=std::panic::catch_unwind(||result.unwrap_err().stack_pop());
assert!(catch_panic.is_err());