jvmti_rs/wrapper/enums/
jlocation_format.rs

1use crate::sys;
2
3#[derive(Debug)]
4pub enum JvmtiJlocationFormat {
5    Jvmbci,
6    MachinePc,
7    Other,
8    Unsupported(sys::jvmtiJlocationFormat),
9}
10
11
12impl From<sys::jvmtiJlocationFormat> for JvmtiJlocationFormat {
13    fn from(value: sys::jvmtiJlocationFormat) -> Self {
14        match value {
15            sys::JVMTI_JLOCATION_JVMBCI => JvmtiJlocationFormat::Jvmbci,
16            sys::JVMTI_JLOCATION_MACHINEPC => JvmtiJlocationFormat::MachinePc,
17            sys::JVMTI_JLOCATION_OTHER => JvmtiJlocationFormat::Other,
18            _ => JvmtiJlocationFormat::Unsupported(value)
19        }
20    }
21}
22
23impl From<JvmtiJlocationFormat> for sys::jvmtiJlocationFormat {
24    fn from(value: JvmtiJlocationFormat) -> Self {
25        match value {
26            JvmtiJlocationFormat::Jvmbci => sys::JVMTI_JLOCATION_JVMBCI,
27            JvmtiJlocationFormat::MachinePc => sys::JVMTI_JLOCATION_MACHINEPC,
28            JvmtiJlocationFormat::Other => sys::JVMTI_JLOCATION_OTHER,
29            _ => sys::JVMTI_CONSTANT_UNSUPPORTED,
30        }
31    }
32}