1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
// Copyright 2018 Arnau Siches // Licensed under the MIT license <LICENSE or http://opensource.org/licenses/MIT>. // This file may not be copied, modified, or distributed except // according to those terms. //! Tag bytes #[derive(Debug, Clone, Copy)] pub enum Tag { Bool = 0x62, Dict = 0x64, Float = 0x66, Integer = 0x69, List = 0x6C, Null = 0x6E, Raw = 0x72, Set = 0x73, Timestamp = 0x74, Unicode = 0x75, } impl Tag { pub fn to_bytes(&self) -> [u8; 1] { [*self as u8] } } #[cfg(test)] mod tests { use super::*; #[test] fn unicode_byte() { assert_eq!(Tag::Unicode.to_bytes(), [0x75; 1]) } }