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 0c81f94 commit f8c1d2aCopy full SHA for f8c1d2a
library/core/src/iter/sources/repeat.rs
@@ -8,6 +8,9 @@ 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
+/// > Please prefer [`str::repeat()`] over this function if you just want
12
+/// > to repeat 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.
0 commit comments