regex_automata::meta::strategy

Function copy_match_to_slots

source
fn copy_match_to_slots(m: Match, slots: &mut [Option<NonMaxUsize>])
Expand description

Copies the offsets in the given match to the corresponding positions in slots.

In effect, this sets the slots corresponding to the implicit group for the pattern in the given match. If the indices for the corresponding slots do not exist, then no slots are set.

This is useful when the caller provides slots (or captures), but you use a regex engine that doesn’t operate on slots (like a lazy DFA). This function lets you map the match you get back to the slots provided by the caller.