bors 17600c1ea7 Auto merge of #44682 - bluss:iter-rfold, r=dtolnay
Add iterator method .rfold(init, function); the reverse of fold

rfold is the reverse version of fold.

Fold allows iterators to implement a different (non-resumable) internal
iteration when it is more efficient than the external iteration implemented
through the next method. (Common examples are VecDeque and .chain()).

Introduce rfold() so that the same customization is available for reverse
iteration. This is achieved by both adding the method, and by having the
Rev\<I> adaptor connect Rev::rfold → I::fold and Rev::fold → I::rfold.

On the surface, rfold(..) is just .rev().fold(..), but the special case
implementations allow a data structure specific fold to be used through for
example .iter().rev(); we thus have gains even for users never calling exactly
rfold themselves.
2017-09-21 23:44:11 +00:00
..
2017-09-19 16:08:19 +02:00
2017-09-17 21:40:13 +02:00
2017-09-20 20:48:06 +02:00
2017-09-20 16:49:21 +03:00
2017-09-20 20:48:06 +02:00
2017-09-19 09:20:35 +02:00