lazy iterator
An iterator does no work until something asks it for the next item.
Iterator adapters build a description of work; items are produced only when a consumer (a for loop, collect, sum...) calls next.
Loading interactive…
Examples
v.iter().map(|x| { println!("{x}"); x });on its own prints nothing and warnsunused Map that must be used; adding.count()makes it run.
See also