[][src]Trait backtracking_iterator::Walkbackable

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;
}

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

Associated Types

type RefPoint

The type used to refer to positions in the history

type Item

The type of item in the history

type Walkback: Walkback<'history, Item = Self::Item, RefPoint = Self::RefPoint>

The type of the walk-back iterator

Loading content...

Required methods

fn walk_back(&'history self) -> Self::Walkback

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

Implementors

impl<'history, 'record, I: 'history> Walkbackable<'history> for CopyingBacktrackingIterator<'record, I> where
    I: Iterator,
    I::Item: Clone,
    'history: 'record, 
[src]

type RefPoint = usize

type Item = I::Item

type Walkback = CopyingWalkback<'history, I>

impl<'history, 'record, Iter: 'history> Walkbackable<'history> for ReferencingBacktrackingIterator<'record, Iter> where
    Iter: Iterator,
    'history: 'record, 
[src]

type RefPoint = usize

type Item = &'record Iter::Item

type Walkback = ReferencingWalkback<'record, Iter>

Loading content...