-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows an array to move its values out through iteration. I find this especially handy for `flat_map`, to expand one item into several without having to allocate a `Vec`, like one of the new tests: fn test_iterator_flat_map() { assert!((0..5).flat_map(|i| [2 * i, 2 * i + 1]).eq(0..10)); } Note the array must be moved for the iterator to own it, so you probably don't want this for large `T` or very many items. But for small arrays, it should be faster than bothering with a vector and the heap.
- Loading branch information
Showing
6 changed files
with
371 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.