pub trait Walkbackable<'history> {
    type RefPoint;
    type Item;
    type Walkback: Walkback<'history, Item = Self::Item, RefPoint = Self::RefPoint>;

    fn walk_back(&'history self) -> Self::Walkback;
}
Expand description

An iterator that can be walked back on, parameterised for a lifetime This trait is a workaround for the lack of generic associated types - it is expected to be implemented for every lifetime, for reasons of utility

Required Associated Types

The type used to refer to positions in the history

The type of item in the history

The type of the walk-back iterator

Required Methods

Produce an iterator which goes back over the current history in reverse, and yields items in the history.

extern crate backtracking_iterator;
use backtracking_iterator::{BacktrackingIterator, Walkbackable};

let v = vec![1_u8, 2_u8];
let mut rec = backtracking_iterator::BacktrackingRecorder::new(v.into_iter());
let mut bt = rec.copying();
bt.next();

let mut wb = bt.walk_back();

assert!(wb.next().unwrap() == 1_u8);

Implementors