File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2625,6 +2625,28 @@ pub trait Itertools : Iterator {
2625
2625
None => Err ( ExactlyOneError :: new ( ( None , None ) , self ) ) ,
2626
2626
}
2627
2627
}
2628
+
2629
+ /// An iterator adaptor that allows the user to peek at multiple `.next()`
2630
+ /// values without advancing the base iterator.
2631
+ ///
2632
+ /// # Examples
2633
+ /// ```
2634
+ /// use itertools::Itertools;
2635
+ ///
2636
+ /// let mut iter = (0..10).multipeek();
2637
+ /// assert_eq!(iter.peek(), Some(&0));
2638
+ /// assert_eq!(iter.peek(), Some(&1));
2639
+ /// assert_eq!(iter.peek(), Some(&2));
2640
+ /// assert_eq!(iter.next(), Some(0));
2641
+ /// assert_eq!(iter.peek(), Some(&1));
2642
+ /// ```
2643
+ #[ cfg( feature = "use_std" ) ]
2644
+ fn multipeek ( self ) -> MultiPeek < Self >
2645
+ where
2646
+ Self : Sized ,
2647
+ {
2648
+ multipeek_impl:: multipeek ( self )
2649
+ }
2628
2650
}
2629
2651
2630
2652
impl < T : ?Sized > Itertools for T where T : Iterator { }
You can’t perform that action at this time.
0 commit comments