@@ -23,7 +23,7 @@ use {Bucket, HashValue};
2323
2424/// Trait for the "size class". Either u32 or u64 depending on the index
2525/// size needed to address an entry's index in self.core.entries.
26- pub ( crate ) trait Size {
26+ trait Size {
2727 fn is_64_bit ( ) -> bool ;
2828 fn is_same_size < T : Size > ( ) -> bool {
2929 Self :: is_64_bit ( ) == T :: is_64_bit ( )
@@ -392,14 +392,14 @@ impl<K, V> IndexMapCore<K, V> {
392392
393393 // Return whether we need 32 or 64 bits to specify a bucket or entry index
394394 #[ cfg( not( feature = "test_low_transition_point" ) ) ]
395- pub ( crate ) fn size_class_is_64bit ( & self ) -> bool {
395+ fn size_class_is_64bit ( & self ) -> bool {
396396 usize:: max_value ( ) > u32:: max_value ( ) as usize
397397 && self . raw_capacity ( ) >= u32:: max_value ( ) as usize
398398 }
399399
400400 // for testing
401401 #[ cfg( feature = "test_low_transition_point" ) ]
402- pub ( crate ) fn size_class_is_64bit ( & self ) -> bool {
402+ fn size_class_is_64bit ( & self ) -> bool {
403403 self . raw_capacity ( ) >= 64
404404 }
405405
@@ -444,7 +444,7 @@ impl<K, V> IndexMapCore<K, V> {
444444
445445 #[ inline( never) ]
446446 // `Sz` is *current* Size class, before grow
447- pub ( crate ) fn double_capacity < Sz > ( & mut self )
447+ fn double_capacity < Sz > ( & mut self )
448448 where
449449 Sz : Size ,
450450 {
@@ -523,7 +523,7 @@ impl<K, V> IndexMapCore<K, V> {
523523 Some ( self . swap_remove_found ( probe, found) )
524524 }
525525
526- pub ( crate ) fn insert_phase_1 < ' a , Sz , A > ( & ' a mut self , hash : HashValue , key : K , action : A ) -> A :: Output
526+ fn insert_phase_1 < ' a , Sz , A > ( & ' a mut self , hash : HashValue , key : K , action : A ) -> A :: Output
527527 where
528528 Sz : Size ,
529529 K : Eq ,
@@ -590,6 +590,14 @@ impl<K, V> IndexMapCore<K, V> {
590590 dispatch_32_vs_64 ! ( self . insert_phase_1:: <_>( hash, key, InsertValue ( value) ) )
591591 }
592592
593+ pub ( crate ) fn entry ( & mut self , hash : HashValue , key : K ) -> Entry < K , V >
594+ where
595+ K : Eq ,
596+ {
597+ self . reserve_one ( ) ;
598+ dispatch_32_vs_64 ! ( self . insert_phase_1:: <_>( hash, key, MakeEntry ) )
599+ }
600+
593601 /// Return probe (indices) and position (entries)
594602 pub ( crate ) fn find_using < F > ( & self , hash : HashValue , key_eq : F ) -> Option < ( usize , usize ) >
595603 where
@@ -875,7 +883,7 @@ impl<K, V> IndexMapCore<K, V> {
875883 }
876884}
877885
878- pub ( crate ) trait ProbeAction < ' a , Sz : Size , K , V > : Sized {
886+ trait ProbeAction < ' a , Sz : Size , K , V > : Sized {
879887 type Output ;
880888 // handle an occupied spot in the map
881889 fn hit ( self , entry : OccupiedEntry < ' a , K , V > ) -> Self :: Output ;
@@ -914,7 +922,7 @@ impl<'a, Sz: Size, K, V> ProbeAction<'a, Sz, K, V> for InsertValue<V> {
914922 }
915923}
916924
917- pub ( crate ) struct MakeEntry ;
925+ struct MakeEntry ;
918926
919927impl < ' a , Sz : Size , K : ' a , V : ' a > ProbeAction < ' a , Sz , K , V > for MakeEntry {
920928 type Output = Entry < ' a , K , V > ;
0 commit comments