pub struct Backtracker { /* private fields */ }Expand description
A linear backtracking choice point over a fixed list of alternatives.
Models the choose/fail surface of non-deterministic control: each
Backtracker::choose or Backtracker::fail commits to the next
alternative, yielding BacktrackStep::Failed once they run out.
Implementations§
Source§impl Backtracker
impl Backtracker
Sourcepub fn new(alternatives: Vec<Ref>) -> Self
pub fn new(alternatives: Vec<Ref>) -> Self
Builds a backtracker that walks alternatives in order.
Sourcepub fn choose(&mut self) -> BacktrackStep
pub fn choose(&mut self) -> BacktrackStep
Commits to the next alternative, or BacktrackStep::Failed if none
remain.
Sourcepub fn fail(&mut self) -> BacktrackStep
pub fn fail(&mut self) -> BacktrackStep
Backtracks the current choice and advances to the next alternative;
equivalent to Backtracker::choose.
Trait Implementations§
Source§impl Clone for Backtracker
impl Clone for Backtracker
Source§fn clone(&self) -> Backtracker
fn clone(&self) -> Backtracker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Backtracker
impl Debug for Backtracker
impl Eq for Backtracker
Source§impl PartialEq for Backtracker
impl PartialEq for Backtracker
Source§fn eq(&self, other: &Backtracker) -> bool
fn eq(&self, other: &Backtracker) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Backtracker
Auto Trait Implementations§
impl Freeze for Backtracker
impl RefUnwindSafe for Backtracker
impl Send for Backtracker
impl Sync for Backtracker
impl Unpin for Backtracker
impl UnsafeUnpin for Backtracker
impl UnwindSafe for Backtracker
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