Rollup merge of #77194 - pickfire:patch-7, r=withoutboats

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`.
This commit is contained in:
Ralf Jung 2020-09-28 18:39:46 +02:00 committed by GitHub
commit aba966a592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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