-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtypes.rs
More file actions
50 lines (46 loc) · 1.84 KB
/
Copy pathtypes.rs
File metadata and controls
50 lines (46 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use crate::attribute_info::AttributeInfo;
use crate::constant_info::ConstantInfo;
use crate::field_info::FieldInfo;
use crate::method_info::MethodInfo;
use binrw::binrw;
#[derive(Clone, Debug)]
#[binrw]
#[brw(big, magic = b"\xca\xfe\xba\xbe")]
pub struct ClassFile {
pub minor_version: u16,
pub major_version: u16,
pub const_pool_size: u16,
#[br(args { count: const_pool_size.into() })]
pub const_pool: Vec<ConstantInfo>,
pub access_flags: ClassAccessFlags,
pub this_class: u16,
pub super_class: u16,
pub interfaces_count: u16,
#[br(args { count: interfaces_count.into() })]
pub interfaces: Vec<u16>,
pub fields_count: u16,
#[br(args { count: fields_count.into() })]
pub fields: Vec<FieldInfo>,
pub methods_count: u16,
#[br(args { count: methods_count.into() })]
pub methods: Vec<MethodInfo>,
pub attributes_count: u16,
#[br(args { count: attributes_count.into() })]
pub attributes: Vec<AttributeInfo>,
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[binrw]
pub struct ClassAccessFlags(u16);
bitflags! {
impl ClassAccessFlags: u16 {
const PUBLIC = 0x0001; // Declared public; may be accessed from outside its package.
const FINAL = 0x0010; // Declared final; no subclasses allowed.
const SUPER = 0x0020; // Treat superclass methods specially when invoked by the invokespecial instruction.
const INTERFACE = 0x0200; // Is an interface, not a class.
const ABSTRACT = 0x0400; // Declared abstract; must not be instantiated.
const SYNTHETIC = 0x1000; // Declared synthetic; not present in the source code.
const ANNOTATION = 0x2000; // Declared as an annotation type.
const ENUM = 0x4000; // Declared as an enum type.
const MODULE = 0x8000; // Declared as a module type.
}
}