Iter from Function
As simple as it sounds. You have a function, you want to create an infinite iterable that repeatedly calls said function over and over? This package is for you
Usage
If you have a function, just pass it to the from
function of the package.
You can use take to get a specified number of elements.
extern crate iter_from_fn;
assert_eq!;
let mut x = 0;
let closure =
assert_eq!;
You can also use it in a for loop and break
extern crate iter_from_fn;
let mut x = 1;
let closure = ;
let mut v = Vec new;
for x in from
assert_eq!;
Use a closure if you need to bind values to arguments.
extern crate iter_from_fn;
let vec_100_capacity = ;
let mut it = from;
assert_eq!;