File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
library/core/src/iter/sources Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,17 @@ use crate::num::NonZero;
8
8
/// Infinite iterators like `repeat()` are often used with adapters like
9
9
/// [`Iterator::take()`], in order to make them finite.
10
10
///
11
+ /// If you know the number of repetitions in advance, consider using [`repeat_n()`]
12
+ /// instead, as it is more efficient and conveys the intent more clearly.
13
+ ///
11
14
/// Use [`str::repeat()`] instead of this function if you just want to repeat
12
15
/// a char/string `n` times.
13
16
///
14
17
/// If the element type of the iterator you need does not implement `Clone`,
15
18
/// or if you do not want to keep the repeated element in memory, you can
16
19
/// instead use the [`repeat_with()`] function.
17
20
///
21
+ /// [`repeat_n()`]: crate::iter::repeat_n
18
22
/// [`repeat_with()`]: crate::iter::repeat_with
19
23
/// [`str::repeat()`]: ../../std/primitive.str.html#method.repeat
20
24
///
You can’t perform that action at this time.
0 commit comments