Function iter_from_closure::iter_from_closure [] [src]

pub fn iter_from_closure<Item, F>(closure: F) -> MutFn<Item, F> where
    F: FnMut() -> Option<Item>, 

Converts a closure of form FnMut() -> Option<Item> into a struct implementing Iterator<Item = Item>.

This is intended for use cases where you want to quickly create an Iterator for one time use from some state that you have, but where creating a struct to carry the state and then implementing Iterator is verbose and adds a lot of boilerplate.