blot/
tag.rs

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