jvmti_rs/wrapper/jvmtifns/
extension_mechanism.rs

1use crate::{builder::*, errors::*, JVMTIEnv, objects::*, sys::*};
2
3impl<'a> JVMTIEnv<'a> {
4    pub fn get_extension_events(&self) -> Result<Vec<JExtensionEventInfo>> {
5        let mut builder: MutAutoDeallocateObjectArrayBuilder<jvmtiExtensionEventInfo> = MutAutoDeallocateObjectArrayBuilder::new();
6        let res = jvmti_call_result!( self.jvmti_raw(), GetExtensionEvents,
7            &mut builder.count,
8            &mut builder.items
9        );
10        jvmti_error_code_to_result(res)?;
11        Ok(builder.build(self))
12    }
13
14    pub fn get_extension_functions(&self) -> Result<Vec<JExtensionFunctionInfo>> {
15        let mut builder: MutAutoDeallocateObjectArrayBuilder<jvmtiExtensionFunctionInfo> = MutAutoDeallocateObjectArrayBuilder::new();
16        let res = jvmti_call_result!( self.jvmti_raw(), GetExtensionFunctions,
17            &mut builder.count,
18            &mut builder.items
19        );
20        jvmti_error_code_to_result(res)?;
21        Ok(builder.build(self))
22    }
23
24    pub fn set_extension_event_callback(&self, extension_event_index: jint, callback: jvmtiExtensionEvent) -> Result<()> {
25        jvmti_call!(self.jvmti_raw(), SetExtensionEventCallback,
26            extension_event_index,
27            callback
28        )
29    }
30}