File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -515,8 +515,9 @@ pub trait Itertools: Iterator {
515
515
///
516
516
/// It's a generalisation of [`Iterator::take`] and [`Iterator::skip`],
517
517
/// and uses these under the hood.
518
- /// Therefore, the resulting iterator is [`DoubleEndedIterator`]
519
- /// and/or [`ExactSizeIterator`] if the adapted iterator is.
518
+ /// Therefore, the resulting iterator is:
519
+ /// - [`ExactSizeIterator`] if the adapted iterator is [`ExactSizeIterator`].
520
+ /// - [`DoubleEndedIterator`] if the adapted iterator is [`DoubleEndedIterator`] and [`ExactSizeIterator`].
520
521
///
521
522
/// # Unspecified Behavior
522
523
/// The result of indexing with an exhausted [`core::ops::RangeInclusive`] is unspecified.
Original file line number Diff line number Diff line change @@ -18,6 +18,28 @@ use crate::it::Itertools;
18
18
use core:: iter;
19
19
use itertools as it;
20
20
21
+ #[ allow( dead_code) ]
22
+ fn get_esi_then_esi < I : ExactSizeIterator + Clone > ( it : I ) {
23
+ fn is_esi ( _: impl ExactSizeIterator ) { }
24
+ is_esi ( it. clone ( ) . get ( 1 ..4 ) ) ;
25
+ is_esi ( it. clone ( ) . get ( 1 ..=4 ) ) ;
26
+ is_esi ( it. clone ( ) . get ( 1 ..) ) ;
27
+ is_esi ( it. clone ( ) . get ( ..4 ) ) ;
28
+ is_esi ( it. clone ( ) . get ( ..=4 ) ) ;
29
+ is_esi ( it. get ( ..) ) ;
30
+ }
31
+
32
+ #[ allow( dead_code) ]
33
+ fn get_dei_esi_then_dei_esi < I : DoubleEndedIterator + ExactSizeIterator + Clone > ( it : I ) {
34
+ fn is_dei_esi ( _: impl DoubleEndedIterator + ExactSizeIterator ) { }
35
+ is_dei_esi ( it. clone ( ) . get ( 1 ..4 ) ) ;
36
+ is_dei_esi ( it. clone ( ) . get ( 1 ..=4 ) ) ;
37
+ is_dei_esi ( it. clone ( ) . get ( 1 ..) ) ;
38
+ is_dei_esi ( it. clone ( ) . get ( ..4 ) ) ;
39
+ is_dei_esi ( it. clone ( ) . get ( ..=4 ) ) ;
40
+ is_dei_esi ( it. get ( ..) ) ;
41
+ }
42
+
21
43
#[ test]
22
44
fn product0 ( ) {
23
45
let mut prod = iproduct ! ( ) ;
You can’t perform that action at this time.
0 commit comments