File tree Expand file tree Collapse file tree 2 files changed +30
-25
lines changed Expand file tree Collapse file tree 2 files changed +30
-25
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " rmp"
3- version = " 0.8.13 "
3+ version = " 0.8.14 "
44authors = [" Evgeny Safronov <division494@gmail.com>" ]
55license = " MIT"
66description = " Pure Rust MessagePack serialization implementation"
Original file line number Diff line number Diff line change @@ -4,12 +4,26 @@ const FIXMAP_SIZE : u8 = 0x0f;
44
55/// Format markers.
66#[ derive( Clone , Copy , Debug , PartialEq ) ]
7+ #[ repr( u8 ) ]
78pub enum Marker {
8- FixPos ( u8 ) ,
9- FixNeg ( i8 ) ,
10- Null ,
11- True ,
9+ FixPos ( u8 ) = 0x00 ,
10+ FixNeg ( i8 ) = 0xe0 ,
11+ FixMap ( u8 ) = 0x80 ,
12+ FixArray ( u8 ) = 0x90 ,
13+ FixStr ( u8 ) = 0xa0 ,
14+ Null = 0xc0 ,
15+ // Marked in MessagePack spec as never used.
16+ Reserved ,
1217 False ,
18+ True ,
19+ Bin8 ,
20+ Bin16 ,
21+ Bin32 ,
22+ Ext8 ,
23+ Ext16 ,
24+ Ext32 ,
25+ F32 ,
26+ F64 ,
1327 U8 ,
1428 U16 ,
1529 U32 ,
@@ -18,35 +32,24 @@ pub enum Marker {
1832 I16 ,
1933 I32 ,
2034 I64 ,
21- F32 ,
22- F64 ,
23- FixStr ( u8 ) ,
35+ FixExt1 ,
36+ FixExt2 ,
37+ FixExt4 ,
38+ FixExt8 ,
39+ FixExt16 ,
2440 Str8 ,
2541 Str16 ,
2642 Str32 ,
27- Bin8 ,
28- Bin16 ,
29- Bin32 ,
30- FixArray ( u8 ) ,
3143 Array16 ,
3244 Array32 ,
33- FixMap ( u8 ) ,
3445 Map16 ,
3546 Map32 ,
36- FixExt1 ,
37- FixExt2 ,
38- FixExt4 ,
39- FixExt8 ,
40- FixExt16 ,
41- Ext8 ,
42- Ext16 ,
43- Ext32 ,
44- Reserved ,
4547}
4648
4749impl Marker {
4850 /// Construct a msgpack marker from a single byte.
4951 #[ must_use]
52+ #[ inline]
5053 pub fn from_u8 ( n : u8 ) -> Marker {
5154 match n {
5255 0x00 ..= 0x7f => Marker :: FixPos ( n) ,
@@ -91,7 +94,9 @@ impl Marker {
9194 }
9295
9396 /// Converts a marker object into a single-byte representation.
94- #[ must_use] pub fn to_u8 ( & self ) -> u8 {
97+ #[ must_use]
98+ #[ inline]
99+ pub fn to_u8 ( & self ) -> u8 {
95100 match * self {
96101 Marker :: FixPos ( val) => val,
97102 Marker :: FixNeg ( val) => val as u8 ,
@@ -146,14 +151,14 @@ impl Marker {
146151}
147152
148153impl From < u8 > for Marker {
149- #[ inline]
154+ #[ inline( always ) ]
150155 fn from ( val : u8 ) -> Marker {
151156 Marker :: from_u8 ( val)
152157 }
153158}
154159
155160impl From < Marker > for u8 {
156- #[ inline]
161+ #[ inline( always ) ]
157162 fn from ( val : Marker ) -> Self {
158163 val. to_u8 ( )
159164 }
You can’t perform that action at this time.
0 commit comments