@@ -23,7 +23,7 @@ use {Bucket, HashValue};
23
23
24
24
/// Trait for the "size class". Either u32 or u64 depending on the index
25
25
/// size needed to address an entry's index in self.core.entries.
26
- pub ( crate ) trait Size {
26
+ trait Size {
27
27
fn is_64_bit ( ) -> bool ;
28
28
fn is_same_size < T : Size > ( ) -> bool {
29
29
Self :: is_64_bit ( ) == T :: is_64_bit ( )
@@ -392,14 +392,14 @@ impl<K, V> IndexMapCore<K, V> {
392
392
393
393
// Return whether we need 32 or 64 bits to specify a bucket or entry index
394
394
#[ 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 {
396
396
usize:: max_value ( ) > u32:: max_value ( ) as usize
397
397
&& self . raw_capacity ( ) >= u32:: max_value ( ) as usize
398
398
}
399
399
400
400
// for testing
401
401
#[ cfg( feature = "test_low_transition_point" ) ]
402
- pub ( crate ) fn size_class_is_64bit ( & self ) -> bool {
402
+ fn size_class_is_64bit ( & self ) -> bool {
403
403
self . raw_capacity ( ) >= 64
404
404
}
405
405
@@ -444,7 +444,7 @@ impl<K, V> IndexMapCore<K, V> {
444
444
445
445
#[ inline( never) ]
446
446
// `Sz` is *current* Size class, before grow
447
- pub ( crate ) fn double_capacity < Sz > ( & mut self )
447
+ fn double_capacity < Sz > ( & mut self )
448
448
where
449
449
Sz : Size ,
450
450
{
@@ -523,7 +523,7 @@ impl<K, V> IndexMapCore<K, V> {
523
523
Some ( self . swap_remove_found ( probe, found) )
524
524
}
525
525
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
527
527
where
528
528
Sz : Size ,
529
529
K : Eq ,
@@ -590,6 +590,14 @@ impl<K, V> IndexMapCore<K, V> {
590
590
dispatch_32_vs_64 ! ( self . insert_phase_1:: <_>( hash, key, InsertValue ( value) ) )
591
591
}
592
592
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
+
593
601
/// Return probe (indices) and position (entries)
594
602
pub ( crate ) fn find_using < F > ( & self , hash : HashValue , key_eq : F ) -> Option < ( usize , usize ) >
595
603
where
@@ -875,7 +883,7 @@ impl<K, V> IndexMapCore<K, V> {
875
883
}
876
884
}
877
885
878
- pub ( crate ) trait ProbeAction < ' a , Sz : Size , K , V > : Sized {
886
+ trait ProbeAction < ' a , Sz : Size , K , V > : Sized {
879
887
type Output ;
880
888
// handle an occupied spot in the map
881
889
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> {
914
922
}
915
923
}
916
924
917
- pub ( crate ) struct MakeEntry ;
925
+ struct MakeEntry ;
918
926
919
927
impl < ' a , Sz : Size , K : ' a , V : ' a > ProbeAction < ' a , Sz , K , V > for MakeEntry {
920
928
type Output = Entry < ' a , K , V > ;
0 commit comments