File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
datadog-profiling-protobuf/src Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,7 @@ use std::io::{self, Write};
32
32
/// A tag is a combination of a wire_type, stored in the least significant
33
33
/// three bits, and the field number that is defined in the .proto file.
34
34
#[ derive( Copy , Clone ) ]
35
- pub struct Tag {
36
- field : u32 ,
37
- wire_type : WireType ,
38
- }
35
+ pub struct Tag ( u32 ) ;
39
36
40
37
/// A value is stored differently depending on the wire_type.
41
38
pub trait Value {
@@ -132,22 +129,17 @@ impl Tag {
132
129
#[ inline]
133
130
pub const fn new ( field : u32 , wire_type : WireType ) -> Self {
134
131
debug_assert ! ( field >= MIN_FIELD && field <= MAX_FIELD ) ;
135
- Self { field , wire_type }
132
+ Self ( ( field << 3 ) | wire_type as u32 )
136
133
}
137
134
138
135
#[ inline]
139
136
pub fn proto_len ( self ) -> u64 {
140
- self . into_varint ( ) . proto_len ( )
137
+ Varint ( self . 0 as u64 ) . proto_len ( )
141
138
}
142
139
143
140
#[ inline]
144
141
pub fn encode < W : Write > ( self , writer : & mut W ) -> io:: Result < ( ) > {
145
- self . into_varint ( ) . encode ( writer)
146
- }
147
-
148
- #[ inline]
149
- pub const fn into_varint ( self ) -> Varint {
150
- Varint ( ( ( self . field << 3 ) | self . wire_type as u32 ) as u64 )
142
+ Varint ( self . 0 as u64 ) . encode ( writer)
151
143
}
152
144
}
153
145
You can’t perform that action at this time.
0 commit comments