@@ -97,6 +97,7 @@ pub mod structs {
9797        FilterOk ,  Interleave ,  InterleaveShortest ,  MapInto ,  MapOk ,  Positions ,  Product ,  PutBack , 
9898        TakeWhileRef ,  TupleCombinations ,  Update ,  WhileSome , 
9999    } ; 
100+     pub  use  crate :: all_equal_value_err:: AllEqualValueError ; 
100101    #[ cfg( feature = "use_alloc" ) ]  
101102    pub  use  crate :: combinations:: { ArrayCombinations ,  Combinations } ; 
102103    #[ cfg( feature = "use_alloc" ) ]  
@@ -180,6 +181,7 @@ pub use crate::either_or_both::EitherOrBoth;
180181pub  mod  free; 
181182#[ doc( inline) ]  
182183pub  use  crate :: free:: * ; 
184+ mod  all_equal_value_err; 
183185#[ cfg( feature = "use_alloc" ) ]  
184186mod  combinations; 
185187#[ cfg( feature = "use_alloc" ) ]  
@@ -2268,27 +2270,27 @@ pub trait Itertools: Iterator {
22682270     /// two non-equal elements found. 
22692271     /// 
22702272     /// ``` 
2271-      /// use itertools::Itertools; 
2273+      /// use itertools::{ Itertools, AllEqualValueError} ; 
22722274     /// 
22732275     /// let data = vec![1, 1, 1, 2, 2, 3, 3, 3, 4, 5, 5]; 
2274-      /// assert_eq!(data.iter().all_equal_value(), Err(Some(( &1, &2)))); 
2276+      /// assert_eq!(data.iter().all_equal_value(), Err(AllEqualValueError( Some([ &1, &2] )))); 
22752277     /// assert_eq!(data[0..3].iter().all_equal_value(), Ok(&1)); 
22762278     /// assert_eq!(data[3..5].iter().all_equal_value(), Ok(&2)); 
22772279     /// assert_eq!(data[5..8].iter().all_equal_value(), Ok(&3)); 
22782280     /// 
22792281     /// let data: Option<usize> = None; 
2280-      /// assert_eq!(data.into_iter().all_equal_value(), Err(None)); 
2282+      /// assert_eq!(data.into_iter().all_equal_value(), Err(AllEqualValueError( None) )); 
22812283     /// ``` 
22822284     #[ allow( clippy:: type_complexity) ]  
2283-     fn  all_equal_value ( & mut  self )  -> Result < Self :: Item ,  Option < ( Self :: Item ,   Self :: Item ) > > 
2285+     fn  all_equal_value ( & mut  self )  -> Result < Self :: Item ,  AllEqualValueError < Self :: Item > > 
22842286    where 
22852287        Self :  Sized , 
22862288        Self :: Item :  PartialEq , 
22872289    { 
2288-         let  first = self . next ( ) . ok_or ( None ) ?; 
2290+         let  first = self . next ( ) . ok_or ( AllEqualValueError ( None ) ) ?; 
22892291        let  other = self . find ( |x| x != & first) ; 
22902292        if  let  Some ( other)  = other { 
2291-             Err ( Some ( ( first,  other) ) ) 
2293+             Err ( AllEqualValueError ( Some ( [ first,  other] ) ) ) 
22922294        }  else  { 
22932295            Ok ( first) 
22942296        } 
0 commit comments