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;
88/// Infinite iterators like `repeat()` are often used with adapters like
99/// [`Iterator::take()`], in order to make them finite.
1010///
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+ ///
1114/// Use [`str::repeat()`] instead of this function if you just want to repeat
1215/// a char/string `n` times.
1316///
1417/// If the element type of the iterator you need does not implement `Clone`,
1518/// or if you do not want to keep the repeated element in memory, you can
1619/// instead use the [`repeat_with()`] function.
1720///
21+ /// [`repeat_n()`]: crate::iter::repeat_n
1822/// [`repeat_with()`]: crate::iter::repeat_with
1923/// [`str::repeat()`]: ../../std/primitive.str.html#method.repeat
2024///
You can’t perform that action at this time.
0 commit comments