We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
str::repeat
iter::repeat().take().collect()
1 parent a18fbd0 commit 05bf6bcCopy full SHA for 05bf6bc
core/src/iter/sources/repeat.rs
@@ -8,11 +8,15 @@ use crate::num::NonZero;
8
/// Infinite iterators like `repeat()` are often used with adapters like
9
/// [`Iterator::take()`], in order to make them finite.
10
///
11
+/// Use [`str::repeat()`] instead of this function if you just want to repeat
12
+/// a char/string `n`th times.
13
+///
14
/// If the element type of the iterator you need does not implement `Clone`,
15
/// or if you do not want to keep the repeated element in memory, you can
16
/// instead use the [`repeat_with()`] function.
17
18
/// [`repeat_with()`]: crate::iter::repeat_with
19
+/// [`str::repeat()`]: ../../std/primitive.str.html#method.repeat
20
21
/// # Examples
22
0 commit comments