iter_from_closure
Iterator<Item = Item>
creation for one-time use iterators from mutable
closures in the form FnMut() -> Option<Item>
.
Please read [the API documentation here].
How to use with cargo:
rust
[dependencies]
iter_from_closure = "1.0.0"
How to use in your crate:
```rust extern crate iterfromclosure;
use iterfromclosure::iterfromclosure;
let mut count = 5; let iter = iterfromclosure(|| { let c = count; count = c - 1; if c > 0 { Some(c) } else { None } });
assert_eq!(vec![5, 4, 3, 2, 1], iter.collect::
Dual-licensed to be compatible with the Rust project.
Licensed under the [Apache License, Version 2.0] or the [MIT license], at your option. This file may not be copied, modified, or distributed except according to those terms.