‖ Docs.rs ‖ Lib.rs ‖ Crates.io ‖
This is a very small crate providing a macro and a function that allow for conveniently creating iterators on the fly.
The Iterator
Trait is very useful. The problem ist just that we can't simply construct an iterator in-place, but rather have to define a struct, impl
the Iterator
trait for it, and then return a value of that struct.
With the iterate
macro of this crate, you can however do exactly that. See it's documentation for more information.
With the iterator_from
function, you can directly create an iterator from an FnMut
closure (which is exactly the same as what the iterate
macro is doing).