[][src]Trait backtracking_iterator::Record

pub trait Record {
type RefPoint;
    fn get_ref_point(&self) -> Self::RefPoint;
fn forget_before(&mut self, point: Self::RefPoint); fn forget(&mut self) { ... } }

A historical record representation

Associated Types

type RefPoint

The type used to refer to positions in the history

Loading content...

Required methods

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

fn forget_before(&mut self, point: Self::RefPoint)

Eliminate all the values before the given reference point from the history

Loading content...

Provided methods

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);
}
Loading content...

Implementors

impl<Iter> Record for BacktrackingRecorder<Iter> where
    Iter: Iterator
[src]

type RefPoint = usize

Loading content...