[][src]Crate memoiter

Implements a Memoized Iterator, which pairs a normal Iterator<Item=T> with an owned Vec<T> to store the items it returns. Alternatively, it may be considered as a wrapped Vec<T> that is lazily populated with items from the Iterator.

This is useful for infinite Iterators where each value depends on the last, such as the factorial function: Calculating the factorial of 1000 is quite expensive, but it also includes, as byproducts, the factorials of 999, 998, and so on. If these are stored, they can be retrieved later, without needing to be recalculated for their own sake.

Structs

MemoIter

A Memoized Iterator. Wraps an Iterator, associating it with a Vector to store its returns. Past returns can then be retrieved by index.