1use super::*;
2
3#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
5pub enum Type {
6 U32,
8
9 U64,
11
12 String,
14
15 ExpandString,
17
18 MultiString,
20
21 Bytes,
23
24 Other(u32),
26}
27
28impl From<u32> for Type {
29 fn from(ty: u32) -> Self {
30 match ty {
31 REG_DWORD => Self::U32,
32 REG_QWORD => Self::U64,
33 REG_SZ => Self::String,
34 REG_EXPAND_SZ => Self::ExpandString,
35 REG_MULTI_SZ => Self::MultiString,
36 REG_BINARY => Self::Bytes,
37 rest => Self::Other(rest),
38 }
39 }
40}
41
42impl From<Type> for u32 {
43 fn from(ty: Type) -> Self {
44 match ty {
45 Type::U32 => REG_DWORD,
46 Type::U64 => REG_QWORD,
47 Type::String => REG_SZ,
48 Type::ExpandString => REG_EXPAND_SZ,
49 Type::MultiString => REG_MULTI_SZ,
50 Type::Bytes => REG_BINARY,
51 Type::Other(other) => other,
52 }
53 }
54}