unfold
A simple unfold implementation in Rust
unfold let you create an iterator that, staring from a given initial value, applies a given function to the current state, store the result for the next iteration, and return the current state.
Unfold defines an endless iterator: you must stop it by hand, like in the example.
Example
use Unfold;
// Create a vector containing the first 5 numbers from the Fibonacci
// series
let fibonacci_numbers: = new
.map
.take //Unfold iterator never stops.
.collect;
assert_eq!;