1use super::*;
2
3mod attribute;
4mod class_layout;
5mod constant;
6mod field;
7mod generic_param;
8mod impl_map;
9mod interface_impl;
10mod member_ref;
11mod method_def;
12mod module_ref;
13mod nested_class;
14mod param;
15mod type_def;
16mod type_ref;
17mod type_spec;
18
19macro_rules! tables {
20 ($(($name:ident, $table:literal))+) => {
21 $(
22 #[derive(Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
23 pub struct $name(pub Row);
24 impl AsRow for $name {
25 const TABLE: usize = $table;
26 fn to_row(&self) -> Row {
27 self.0
28 }
29 fn from_row(row: Row) -> Self {
30 $name(row)
31 }
32 }
33 )*
34 };
35}
36
37tables! {
38 (Attribute, 1)
39 (ClassLayout, 16)
40 (Constant, 0)
41 (Field, 2)
42 (GenericParam, 3)
43 (ImplMap, 11)
44 (InterfaceImpl, 4)
45 (MemberRef, 5)
46 (MethodDef, 6)
47 (ModuleRef, 12)
48 (NestedClass, 13)
49 (Param, 7)
50 (TypeDef, 8)
51 (TypeRef, 9)
52 (TypeSpec, 10)
53}
54
55fn trim_tick(name: &str) -> &str {
56 if name.as_bytes().iter().rev().nth(1) == Some(&b'`') {
57 &name[..name.len() - 2]
58 } else {
59 name
60 }
61}
62