enum Frame {
Step {
sid: StateID,
at: usize,
},
RestoreCapture {
slot: SmallIndex,
offset: Option<NonMaxUsize>,
},
}
Expand description
Represents a stack frame on the heap while doing backtracking.
Instead of using explicit recursion for backtracking, we use a stack on the heap to keep track of things that we want to explore if the current backtracking branch turns out to not lead to a match.
Variants§
Step
Look for a match starting at sid
and the given position in the
haystack.
RestoreCapture
Reset the given slot
to the given offset
(which might be None
).
This effectively gives a “scope” to capturing groups, such that an
offset for a particular group only gets returned if the match goes
through that capturing group. If backtracking ends up going down a
different branch that results in a different offset (or perhaps none at
all), then this “restore capture” frame will cause the offset to get
reset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)