Skip to content

Commit 1994cee

Browse files
authored
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.
1 parent b984ef6 commit 1994cee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/src/iter/traits/iterator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,8 @@ pub trait Iterator {
19771977
/// assert_eq!(result, result2);
19781978
/// ```
19791979
#[inline]
1980+
#[doc(alias = "reduce")]
1981+
#[doc(alias = "inject")]
19801982
#[stable(feature = "rust1", since = "1.0.0")]
19811983
fn fold<B, F>(mut self, init: B, mut f: F) -> B
19821984
where

0 commit comments

Comments
 (0)