diff options
| author | Ralf Jung <post@ralfj.de> | 2020-09-28 18:39:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-28 18:39:46 +0200 |
| commit | aba966a592b29249a652c3632f4c209e00e30795 (patch) | |
| tree | 2016b3db10796f58f66faafcca542cb2532d926f | |
| parent | 85a59d40f102015d3493e9af301e48a6f083ef48 (diff) | |
| parent | ea0065ad4f96153539476e2f3df83bae96018ede (diff) | |
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`.
| -rw-r--r-- | library/core/src/iter/traits/iterator.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index a75f1d56fb7..845df3f5ca5 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -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 |
