Creates an iterator from a closure that yields Option<T> values.
// Source: https://github.com/rust-lang/rust | License: Apache-2.0 | Copyright The Rust Project Contributors // Provided via justclaw.it.com; keep this notice with the code. use crate::fmt; /// Creates an iterator with the provided closure /// `F: FnMut() -> Option<T>` as its [`next`](Iterator::next) method. /// /// The iterator will yield the `T`s returned from the closure. /// /// This allows creating a custom iterator with any behavior /// without using the more verbose syntax of creating a dedicated type /// and implementing the [`Iterator`] trait for it. /// /// Note that the `FromFn` iterator doesn’t make assumptions about the behavior of the closure, /// and therefore conservatively does not implement [`FusedIterator`], /// or override [`Iterator::size_hint()`] from its default `(0 ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key