# Function pest::state

source · [−]

    pub fn state<'i, R: RuleType, F>(
        input: &'i str,
        f: F
    ) -> Result<Pairs<'i, R>, Error<R>> where
        F: FnOnce(Box<ParserState<'i, R>>) -> ParseResult<Box<ParserState<'i, R>>>,

Expand description

Creates a `ParserState` from a `&str`, supplying it to a closure `f`.

## Examples

    let input = "";
    pest::state::<(), _>(input, |s| Ok(s)).unwrap();