File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
library/core/src/iter/traits Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1228,7 +1228,11 @@ pub trait Iterator {
12281228
12291229 /// Creates an iterator that skips the first `n` elements.
12301230 ///
1231- /// After they have been consumed, the rest of the elements are yielded.
1231+ /// `skip(n)` skips elements until `n` elements are skipped or the end of the
1232+ /// iterator is reached (whichever happens first). After that, all the remaining
1233+ /// elements are yielded. In particular, if the original iterator is too short,
1234+ /// then the returned iterator is empty.
1235+ ///
12321236 /// Rather than overriding this method directly, instead override the `nth` method.
12331237 ///
12341238 /// # Examples
@@ -1252,7 +1256,14 @@ pub trait Iterator {
12521256 Skip :: new ( self , n)
12531257 }
12541258
1255- /// Creates an iterator that yields its first `n` elements.
1259+ /// Creates an iterator that yields the first `n` elements, or fewer
1260+ /// if the underlying iterator ends sooner.
1261+ ///
1262+ /// `take(n)` yields elements until `n` elements are yielded or the end of
1263+ /// the iterator is reached (whichever happens first).
1264+ /// The returned iterator is a prefix of length `n` if the original iterator
1265+ /// contains at least `n` elements, otherwise it contains all of the
1266+ /// (fewer than `n`) elements of the original iterator.
12561267 ///
12571268 /// # Examples
12581269 ///
You can’t perform that action at this time.
0 commit comments