Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6c4029a

Browse files
authored
Rollup merge ofrust-lang#127592 - tesuji:patch-1, r=Mark-Simulacrum
doc: Suggest `str::repeat` over `iter::repeat().take().collect()`r? libs
2 parents54435f7 +05bf6bc commit6c4029a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎core/src/iter/sources/repeat.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ 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+
/// Use [`str::repeat()`] instead of this function if you just want to repeat
12+
/// a char/string `n`th times.
13+
///
1114
/// If the element type of the iterator you need does not implement `Clone`,
1215
/// or if you do not want to keep the repeated element in memory, you can
1316
/// instead use the [`repeat_with()`] function.
1417
///
1518
/// [`repeat_with()`]: crate::iter::repeat_with
19+
/// [`str::repeat()`]: ../../std/primitive.str.html#method.repeat
1620
///
1721
/// # Examples
1822
///

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp