@@ -2198,7 +2198,12 @@ pub trait ParallelIterator: Sized + Send {
2198
2198
Intersperse :: new ( self , element)
2199
2199
}
2200
2200
2201
- /// Creates an iterator that yields the first `n` elements.
2201
+ /// Creates an iterator that yields `n` elements from *anywhere* in the original iterator.
2202
+ ///
2203
+ /// This is similar to [`IndexedParallelIterator::take`] without being
2204
+ /// constrained to the "first" `n` of the original iterator order. The
2205
+ /// taken items will still maintain their relative order where that is
2206
+ /// visible in `collect`, `reduce`, and similar outputs.
2202
2207
///
2203
2208
/// # Examples
2204
2209
///
@@ -2212,12 +2217,18 @@ pub trait ParallelIterator: Sized + Send {
2212
2217
/// .collect();
2213
2218
///
2214
2219
/// assert_eq!(result.len(), 5);
2220
+ /// assert!(result.windows(2).all(|w| w[0] < w[1]));
2215
2221
/// ```
2216
2222
fn take_any ( self , n : usize ) -> TakeAny < Self > {
2217
2223
TakeAny :: new ( self , n)
2218
2224
}
2219
2225
2220
- /// Creates an iterator that skips the first `n` elements.
2226
+ /// Creates an iterator that skips `n` elements from *anywhere* in the original iterator.
2227
+ ///
2228
+ /// This is similar to [`IndexedParallelIterator::skip`] without being
2229
+ /// constrained to the "first" `n` of the original iterator order. The
2230
+ /// remaining items will still maintain their relative order where that is
2231
+ /// visible in `collect`, `reduce`, and similar outputs.
2221
2232
///
2222
2233
/// # Examples
2223
2234
///
@@ -2231,6 +2242,7 @@ pub trait ParallelIterator: Sized + Send {
2231
2242
/// .collect();
2232
2243
///
2233
2244
/// assert_eq!(result.len(), 45);
2245
+ /// assert!(result.windows(2).all(|w| w[0] < w[1]));
2234
2246
/// ```
2235
2247
fn skip_any ( self , n : usize ) -> SkipAny < Self > {
2236
2248
SkipAny :: new ( self , n)
0 commit comments