regex_automata::nfa::thompson::backtrack

Function min_visited_capacity

Source
pub fn min_visited_capacity(nfa: &NFA, input: &Input<'_>) -> usize
Expand description

Returns the minimum visited capacity for the given haystack.

This function can be used as the argument to Config::visited_capacity in order to guarantee that a backtracking search for the given input won’t return an error when using a BoundedBacktracker built from the given NFA.

This routine exists primarily as a way to test that the bounded backtracker works correctly when its capacity is set to the smallest possible amount. Still, it may be useful in cases where you know you want to use the bounded backtracker for a specific input, and just need to know what visited capacity to provide to make it work.

Be warned that this number could be quite large as it is multiplicative in the size the given NFA and haystack.