messagepack_rs/marker/
from.rs1use super::Marker;
2
3impl From<u8> for Marker {
4 fn from(n: u8) -> Marker {
5 match n {
6 0x00..=0x7f => Self::PositiveFixInt(n),
7 0x80..=0x8f => Self::FixMap(n & 0x0f),
8 0x90..=0x9f => Self::FixArray(n & 0x0f),
9 0xa0..=0xbf => Self::FixStr(n & 0x1f),
10 0xc0 => Self::Nil,
11 0xc1 => Self::Reserved,
12 0xc2 => Self::False,
13 0xc3 => Self::True,
14 0xc4 => Self::Bin8,
15 0xc5 => Self::Bin16,
16 0xc6 => Self::Bin32,
17 0xc7 => Self::Ext8,
18 0xc8 => Self::Ext16,
19 0xc9 => Self::Ext32,
20 0xca => Self::Float32,
21 0xcb => Self::Float64,
22 0xcc => Self::UInt8,
23 0xcd => Self::UInt16,
24 0xce => Self::UInt32,
25 0xcf => Self::UInt64,
26 0xd0 => Self::Int8,
27 0xd1 => Self::Int16,
28 0xd2 => Self::Int32,
29 0xd3 => Self::Int64,
30 0xd4 => Self::FixExt1,
31 0xd5 => Self::FixExt2,
32 0xd6 => Self::FixExt4,
33 0xd7 => Self::FixExt8,
34 0xd8 => Self::FixExt16,
35 0xd9 => Self::Str8,
36 0xda => Self::Str16,
37 0xdb => Self::Str32,
38 0xdc => Self::Array16,
39 0xdd => Self::Array32,
40 0xde => Self::Map16,
41 0xdf => Self::Map32,
42 0xe0..=0xff => Self::NegativeFixInt(n as i8),
43 }
44 }
45}