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.
This commit is contained in:
Ivan Tham 2020-09-26 00:04:34 +08:00 committed by GitHub
parent b984ef6797
commit 1994cee61a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1977,6 +1977,8 @@ pub trait Iterator {
/// assert_eq!(result, result2); /// assert_eq!(result, result2);
/// ``` /// ```
#[inline] #[inline]
#[doc(alias = "reduce")]
#[doc(alias = "inject")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn fold<B, F>(mut self, init: B, mut f: F) -> B fn fold<B, F>(mut self, init: B, mut f: F) -> B
where where