]> git.lizzy.rs Git - rust.git/commit
core: Add DoubleEndedIterator::rfold
authorUlrik Sverdrup <bluss@users.noreply.github.com>
Mon, 18 Sep 2017 19:19:58 +0000 (21:19 +0200)
committerUlrik Sverdrup <bluss@users.noreply.github.com>
Mon, 18 Sep 2017 19:55:38 +0000 (21:55 +0200)
commit91318c8cab25504472deb5cd89e6a11fed60fe13
treec5af544a26fe94956b236a4e7c56047c71fe4aac
parentffd171e47f6cdd5b05e377cbcf088070720f31bc
core: Add DoubleEndedIterator::rfold

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, Rev::fold -> I::rfold.
src/libcore/iter/traits.rs