@@ -35,7 +35,9 @@ pub mod iterators;
3535#[ cfg( not( feature = "std" ) ) ]  
3636use  std:: vec:: Vec ; 
3737
38+ use  crate :: better_to_rebuild; 
3839use  crate :: core_iterators:: * ; 
40+ use  crate :: store:: { left,  parent,  right} ; 
3941use  crate :: store:: { Index ,  Position ,  Store } ; 
4042use  crate :: TryReserveError ; 
4143use  iterators:: * ; 
@@ -730,13 +732,6 @@ where
730732    } 
731733} 
732734
733- impl < I ,  P ,  H >  PriorityQueue < I ,  P ,  H > 
734- where 
735-     P :  Ord , 
736-     I :  Hash  + Eq , 
737- { 
738- } 
739- 
740735impl < I ,  P ,  H >  PriorityQueue < I ,  P ,  H > 
741736where 
742737    P :  Ord , 
@@ -772,7 +767,7 @@ where
772767            self . store . swap ( i,  largest) ; 
773768
774769            i = largest; 
775-             let   mut   largestp = unsafe  {  self . store . get_priority_from_position ( i)  } ; 
770+             largestp = unsafe  {  self . store . get_priority_from_position ( i)  } ; 
776771            l = left ( i) ; 
777772            if  l. 0  < self . len ( )  { 
778773                let  childp = unsafe  {  self . store . get_priority_from_position ( l)  } ; 
@@ -977,42 +972,6 @@ where
977972    } 
978973} 
979974
980- /// Compute the index of the left child of an item from its index 
981- #[ inline( always) ]  
982- const  fn  left ( i :  Position )  -> Position  { 
983-     Position ( ( i. 0  *  2 )  + 1 ) 
984- } 
985- /// Compute the index of the right child of an item from its index 
986- #[ inline( always) ]  
987- const  fn  right ( i :  Position )  -> Position  { 
988-     Position ( ( i. 0  *  2 )  + 2 ) 
989- } 
990- /// Compute the index of the parent element in the heap from its index 
991- #[ inline( always) ]  
992- const  fn  parent ( i :  Position )  -> Position  { 
993-     Position ( ( i. 0  - 1 )  / 2 ) 
994- } 
995- 
996- #[ inline( always) ]  
997- const  fn  log2_fast ( x :  usize )  -> usize  { 
998-     ( usize:: BITS  - x. leading_zeros ( )  - 1 )  as  usize 
999- } 
1000- 
1001- // `rebuild` takes O(len1 + len2) operations 
1002- // and about 2 * (len1 + len2) comparisons in the worst case 
1003- // while `extend` takes O(len2 * log_2(len1)) operations 
1004- // and about 1 * len2 * log_2(len1) comparisons in the worst case, 
1005- // assuming len1 >= len2. 
1006- fn  better_to_rebuild ( len1 :  usize ,  len2 :  usize )  -> bool  { 
1007-     // log(1) == 0, so the inequation always falsy 
1008-     // log(0) is inapplicable and produces panic 
1009-     if  len1 <= 1  { 
1010-         return  false ; 
1011-     } 
1012- 
1013-     2  *  ( len1 + len2)  < len2 *  log2_fast ( len1) 
1014- } 
1015- 
1016975#[ cfg( feature = "serde" ) ]  
1017976#[ cfg_attr( docsrs,  doc( cfg( feature = "serde" ) ) ) ]  
1018977mod  serde { 
0 commit comments