File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 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 {
515515 ///
516516 /// It's a generalisation of [`Iterator::take`] and [`Iterator::skip`],
517517 /// 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`].
520521 ///
521522 /// # Unspecified Behavior
522523 /// 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;
1818use core:: iter;
1919use itertools as it;
2020
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+
2143#[ test]
2244fn product0 ( ) {
2345 let mut prod = iproduct ! ( ) ;
You can’t perform that action at this time.
0 commit comments