Function pest::state
[−]
[src]
pub fn state<R: RuleType, I: Input, F>(
input: Rc<I>,
f: F
) -> Result<Pairs<R, I>, Error<R, I>> where
F: FnOnce(&mut ParserState<R, I>, Position<I>) -> Result<Position<I>, Position<I>>,
Creates a ParserState
from an Input
, supplying it to a closure f
.
Examples
let input = Rc::new(StringInput::new("".to_owned())); pest::state::<(), _, _>(input, |_, pos| { Ok(pos) }).unwrap();