classfile_parser/constant_info/
types.rs

1#[derive(Clone, Debug)]
2pub enum ConstantInfo {
3    Utf8(Utf8Constant),
4    Integer(IntegerConstant),
5    Float(FloatConstant),
6    Long(LongConstant),
7    Double(DoubleConstant),
8    Class(ClassConstant),
9    String(StringConstant),
10    FieldRef(FieldRefConstant),
11    MethodRef(MethodRefConstant),
12    InterfaceMethodRef(InterfaceMethodRefConstant),
13    NameAndType(NameAndTypeConstant),
14    MethodHandle(MethodHandleConstant),
15    MethodType(MethodTypeConstant),
16    InvokeDynamic(InvokeDynamicConstant),
17    Unusable,
18}
19
20#[derive(Clone, Debug)]
21pub struct Utf8Constant {
22    pub utf8_string: String,
23    pub bytes: Vec<u8>,
24}
25
26#[derive(Clone, Debug)]
27pub struct IntegerConstant {
28    pub value: i32,
29}
30
31#[derive(Clone, Debug)]
32pub struct FloatConstant {
33    pub value: f32,
34}
35
36#[derive(Clone, Debug)]
37pub struct LongConstant {
38    pub value: i64,
39}
40
41#[derive(Clone, Debug)]
42pub struct DoubleConstant {
43    pub value: f64,
44}
45
46#[derive(Clone, Debug)]
47pub struct ClassConstant {
48    pub name_index: u16,
49}
50
51#[derive(Clone, Debug)]
52pub struct StringConstant {
53    pub string_index: u16,
54}
55
56#[derive(Clone, Debug)]
57pub struct FieldRefConstant {
58    pub class_index: u16,
59    pub name_and_type_index: u16,
60}
61
62#[derive(Clone, Debug)]
63pub struct MethodRefConstant {
64    pub class_index: u16,
65    pub name_and_type_index: u16,
66}
67
68#[derive(Clone, Debug)]
69pub struct InterfaceMethodRefConstant {
70    pub class_index: u16,
71    pub name_and_type_index: u16,
72}
73
74#[derive(Clone, Debug)]
75pub struct NameAndTypeConstant {
76    pub name_index: u16,
77    pub descriptor_index: u16,
78}
79
80#[derive(Clone, Debug)]
81pub struct MethodHandleConstant {
82    pub reference_kind: u8,
83    pub reference_index: u16,
84}
85
86#[derive(Clone, Debug)]
87pub struct MethodTypeConstant {
88    pub descriptor_index: u16,
89}
90
91#[derive(Clone, Debug)]
92pub struct InvokeDynamicConstant {
93    pub bootstrap_method_attr_index: u16,
94    pub name_and_type_index: u16,
95}