Skip to content

Commit

Permalink
Rollup merge of rust-lang#77194 - pickfire:patch-7, r=withoutboats
Browse files Browse the repository at this point in the history
Add doc alias for iterator fold

fold is known in python and javascript as reduce,
not sure about inject but it was written in doc there.

This was my first confusion when coming into rust, I somehow cannot find where is reduce, sometimes I still forget that it is known as `fold`.
  • Loading branch information
RalfJung authored Sep 28, 2020
2 parents a43ee0c + ea0065a commit 29ff334
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1976,6 +1976,8 @@ pub trait Iterator {
/// // they're the same
/// assert_eq!(result, result2);
/// ```
#[doc(alias = "reduce")]
#[doc(alias = "inject")]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn fold<B, F>(mut self, init: B, mut f: F) -> B
Expand Down

0 comments on commit 29ff334

Please sign in to comment.