Trait backtracking_iterator::Record
source · pub trait Record {
type RefPoint;
fn get_ref_point(&self) -> Self::RefPoint;
fn forget_before(&mut self, point: Self::RefPoint);
fn forget(&mut self) { ... }
}
Expand description
A historical record representation
Required Associated Types
Required Methods
sourcefn get_ref_point(&self) -> Self::RefPoint
fn get_ref_point(&self) -> Self::RefPoint
Yield a reference to the current point in the history This reference must be valid for as long as the current point remains in the history
sourcefn forget_before(&mut self, point: Self::RefPoint)
fn forget_before(&mut self, point: Self::RefPoint)
Eliminate all the values before the given reference point from the history
Provided Methods
sourcefn forget(&mut self)
fn forget(&mut self)
Forget all the values before the current position in the iterator
extern crate backtracking_iterator;
use backtracking_iterator::{Record, BacktrackingIterator};
let v = vec![1_u8, 2_u8];
let mut rec = backtracking_iterator::BacktrackingRecorder::new(v.into_iter());
{
let mut bt = rec.copying();
bt.next();
}
//Before we call this, 1_u8 is in the history
rec.forget();
{
let mut bt = rec.copying();
assert!(bt.next().unwrap() == 2_u8);
}