jvmti_rs/wrapper/enums/
object_reference_kind.rs1use crate::sys;
2
3#[derive(Debug)]
4pub enum JvmtiObjectReferenceKind {
5 Class,
6 Field,
7 ArrayElement,
8 ClassLoader,
9 Signers,
10 ProtectionDomain,
11 Interface,
12 StaticField,
13 ConstantPool,
14 Unsupported(sys::jvmtiObjectReferenceKind),
15}
16
17
18impl From<sys::jvmtiObjectReferenceKind> for JvmtiObjectReferenceKind {
19 fn from(value: sys::jvmtiObjectReferenceKind) -> Self {
20 match value {
21 sys::JVMTI_REFERENCE_CLASS => JvmtiObjectReferenceKind::Class,
22 sys::JVMTI_REFERENCE_FIELD => JvmtiObjectReferenceKind::Field,
23 sys::JVMTI_REFERENCE_ARRAY_ELEMENT => JvmtiObjectReferenceKind::ArrayElement,
24 sys::JVMTI_REFERENCE_CLASS_LOADER => JvmtiObjectReferenceKind::ClassLoader,
25 sys::JVMTI_REFERENCE_SIGNERS => JvmtiObjectReferenceKind::Signers,
26 sys::JVMTI_REFERENCE_PROTECTION_DOMAIN => JvmtiObjectReferenceKind::ProtectionDomain,
27 sys::JVMTI_REFERENCE_INTERFACE => JvmtiObjectReferenceKind::Interface,
28 sys::JVMTI_REFERENCE_STATIC_FIELD => JvmtiObjectReferenceKind::StaticField,
29 sys::JVMTI_REFERENCE_CONSTANT_POOL => JvmtiObjectReferenceKind::ConstantPool,
30 _ => JvmtiObjectReferenceKind::Unsupported(value)
31 }
32 }
33}
34
35impl From<JvmtiObjectReferenceKind> for sys::jvmtiObjectReferenceKind {
36 fn from(value: JvmtiObjectReferenceKind) -> Self {
37 match value {
38 JvmtiObjectReferenceKind::Class => sys::JVMTI_REFERENCE_CLASS,
39 JvmtiObjectReferenceKind::Field => sys::JVMTI_REFERENCE_FIELD,
40 JvmtiObjectReferenceKind::ArrayElement => sys::JVMTI_REFERENCE_ARRAY_ELEMENT,
41 JvmtiObjectReferenceKind::ClassLoader => sys::JVMTI_REFERENCE_CLASS_LOADER,
42 JvmtiObjectReferenceKind::Signers => sys::JVMTI_REFERENCE_SIGNERS,
43 JvmtiObjectReferenceKind::ProtectionDomain => sys::JVMTI_REFERENCE_PROTECTION_DOMAIN,
44 JvmtiObjectReferenceKind::Interface => sys::JVMTI_REFERENCE_INTERFACE,
45 JvmtiObjectReferenceKind::StaticField => sys::JVMTI_REFERENCE_STATIC_FIELD,
46 JvmtiObjectReferenceKind::ConstantPool => sys::JVMTI_REFERENCE_CONSTANT_POOL,
47 _ => sys::JVMTI_CONSTANT_UNSUPPORTED,
48 }
49 }
50}