4
4
5
5
//! Tag Indexes
6
6
7
- use std:: collections:: { BTreeMap , BTreeSet } ;
7
+ use std:: collections:: BTreeMap ;
8
8
use std:: ops:: { Deref , DerefMut } ;
9
9
10
10
#[ cfg( feature = "flatbuf" ) ]
@@ -48,10 +48,7 @@ impl TagIndexes {
48
48
if t. len ( ) > 1 {
49
49
if let Some ( single_letter_tag) = single_char_tagname ( t. get ( 0 ) ) {
50
50
let inner = hash ( t. get ( 1 ) ) ;
51
- tag_index
52
- . entry ( single_letter_tag)
53
- . or_default ( )
54
- . insert ( inner) ;
51
+ tag_index. entry ( single_letter_tag) . or_default ( ) . push ( inner) ;
55
52
}
56
53
}
57
54
}
@@ -60,9 +57,10 @@ impl TagIndexes {
60
57
}
61
58
62
59
/// Get hashed `d` tag
60
+ #[ inline]
63
61
pub fn identifier ( & self ) -> Option < [ u8 ; TAG_INDEX_VALUE_SIZE ] > {
64
62
let values = self . inner . get ( & SingleLetterTag :: lowercase ( Alphabet :: D ) ) ?;
65
- values. iter ( ) . next ( ) . copied ( )
63
+ values. first ( ) . copied ( )
66
64
}
67
65
}
68
66
76
74
iter. filter_map ( |t| Some ( ( t. single_letter_tag ( ) ?, t. content ( ) ?) ) )
77
75
{
78
76
let inner = hash ( content) ;
79
- tag_index
80
- . entry ( single_letter_tag)
81
- . or_default ( )
82
- . insert ( inner) ;
77
+ tag_index. entry ( single_letter_tag) . or_default ( ) . push ( inner) ;
83
78
}
84
79
tag_index
85
80
}
@@ -108,11 +103,11 @@ where
108
103
/// Tag Index Values
109
104
#[ derive( Debug , Clone , Default , PartialEq , Eq , Hash ) ]
110
105
pub struct TagIndexValues {
111
- inner : BTreeSet < [ u8 ; TAG_INDEX_VALUE_SIZE ] > ,
106
+ inner : Vec < [ u8 ; TAG_INDEX_VALUE_SIZE ] > ,
112
107
}
113
108
114
109
impl Deref for TagIndexValues {
115
- type Target = BTreeSet < [ u8 ; TAG_INDEX_VALUE_SIZE ] > ;
110
+ type Target = Vec < [ u8 ; TAG_INDEX_VALUE_SIZE ] > ;
116
111
117
112
fn deref ( & self ) -> & Self :: Target {
118
113
& self . inner
0 commit comments