cdefmt_parser/type.rs
1use std::collections::BTreeMap;
2
3// TODO: support booleans larger than 1 byte?
4
5#[derive(Debug, Clone)]
6pub enum Type {
7 Bool,
8 U8,
9 U16,
10 U32,
11 U64,
12 I8,
13 I16,
14 I32,
15 I64,
16 F32,
17 F64,
18 Enumeration {
19 ty: Box<Type>,
20 /// Use i128 to deal with u64 and i64 enums.
21 valid_values: BTreeMap<i128, String>,
22 },
23 Structure(Vec<StructureMember>),
24 Pointer(Box<Type>),
25 Array {
26 ty: Box<Type>,
27 lengths: Vec<u64>,
28 },
29}
30
31#[derive(Debug, Clone)]
32pub struct StructureMember {
33 pub offset: u64,
34 pub name: String,
35 pub ty: Type,
36}