Skip to content

Commit 62f7d56

Browse files
authored
Rollup merge of rust-lang#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`.
2 parents a823d7a + ea0065a commit 62f7d56

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -1976,6 +1976,8 @@ pub trait Iterator {
19761976
/// // they're the same
19771977
/// assert_eq!(result, result2);
19781978
/// ```
1979+
#[doc(alias = "reduce")]
1980+
#[doc(alias = "inject")]
19791981
#[inline]
19801982
#[stable(feature = "rust1", since = "1.0.0")]
19811983
fn fold<B, F>(mut self, init: B, mut f: F) -> B

0 commit comments

Comments
 (0)