Skip to main content

rule_calls

Function rule_calls 

Source
pub fn rule_calls(
    text: &str,
    max_calls: usize,
) -> Result<Option<usize>, Box<Error<Rule>>>
Expand description

How many rule calls a parse of text makes, or None when it makes more than max_calls. Parse errors other than the call limit are returned.

The count is the gate on parse cost: it is deterministic and the same on every machine, where a timing is neither. pest exposes it only as a limit (set_call_limit, a process-wide setting), so the count is the smallest limit the parse completes under, found by bisection; every probe stops at its limit, so a pathological input costs at most max_calls calls per probe rather than running to completion. Probes are serialized because the limit is global, and it is cleared before this returns.