From 1994cee61a4aea9dc46bb3d0323c8290621eda33 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 26 Sep 2020 00:04:34 +0800 Subject: [PATCH] Add alias for iterator fold fold is known in python and javascript as reduce, not sure about inject but it was written in doc there. --- library/core/src/iter/traits/iterator.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index f70e92f0ffaf..ec257a114650 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -1977,6 +1977,8 @@ pub trait Iterator { /// assert_eq!(result, result2); /// ``` #[inline] + #[doc(alias = "reduce")] + #[doc(alias = "inject")] #[stable(feature = "rust1", since = "1.0.0")] fn fold(mut self, init: B, mut f: F) -> B where