pub struct EventCallbacksBuilder { /* private fields */ }Expand description
Builder for raw event callbacks.
Each setter is unsafe because the caller must guarantee the function
pointer remains valid for the lifetime of the JVMTI environment.
§Example
unsafe {
let callbacks = EventCallbacksBuilder::new()
.vm_init(my_vm_init_fn)
.class_load(my_class_load_fn);
callbacks.apply(&env).unwrap();
}Implementations§
Source§impl EventCallbacksBuilder
impl EventCallbacksBuilder
Sourcepub fn as_raw(&self) -> &jvmtiEventCallbacks
pub fn as_raw(&self) -> &jvmtiEventCallbacks
Returns the raw callbacks struct.
Sourcepub fn into_raw(self) -> jvmtiEventCallbacks
pub fn into_raw(self) -> jvmtiEventCallbacks
Consumes the builder and returns the raw callbacks struct.
Sourcepub unsafe fn vm_init(self, cb: jvmtiEventVMInit) -> Self
pub unsafe fn vm_init(self, cb: jvmtiEventVMInit) -> Self
Set the VM init callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn vm_death(self, cb: jvmtiEventVMDeath) -> Self
pub unsafe fn vm_death(self, cb: jvmtiEventVMDeath) -> Self
Set the VM death callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn thread_start(self, cb: jvmtiEventThreadStart) -> Self
pub unsafe fn thread_start(self, cb: jvmtiEventThreadStart) -> Self
Set the thread start callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn thread_end(self, cb: jvmtiEventThreadEnd) -> Self
pub unsafe fn thread_end(self, cb: jvmtiEventThreadEnd) -> Self
Set the thread end callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn class_file_load_hook(
self,
cb: jvmtiEventClassFileLoadHook,
) -> Self
pub unsafe fn class_file_load_hook( self, cb: jvmtiEventClassFileLoadHook, ) -> Self
Set the class file load hook callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn class_load(self, cb: jvmtiEventClassLoad) -> Self
pub unsafe fn class_load(self, cb: jvmtiEventClassLoad) -> Self
Set the class load callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn class_prepare(self, cb: jvmtiEventClassPrepare) -> Self
pub unsafe fn class_prepare(self, cb: jvmtiEventClassPrepare) -> Self
Set the class prepare callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn vm_start(self, cb: jvmtiEventVMStart) -> Self
pub unsafe fn vm_start(self, cb: jvmtiEventVMStart) -> Self
Set the VM start callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn exception(self, cb: jvmtiEventException) -> Self
pub unsafe fn exception(self, cb: jvmtiEventException) -> Self
Set the exception callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn exception_catch(self, cb: jvmtiEventExceptionCatch) -> Self
pub unsafe fn exception_catch(self, cb: jvmtiEventExceptionCatch) -> Self
Set the exception catch callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn single_step(self, cb: jvmtiEventSingleStep) -> Self
pub unsafe fn single_step(self, cb: jvmtiEventSingleStep) -> Self
Set the single step callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn frame_pop(self, cb: jvmtiEventFramePop) -> Self
pub unsafe fn frame_pop(self, cb: jvmtiEventFramePop) -> Self
Set the frame pop callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn breakpoint(self, cb: jvmtiEventBreakpoint) -> Self
pub unsafe fn breakpoint(self, cb: jvmtiEventBreakpoint) -> Self
Set the breakpoint callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn field_access(self, cb: jvmtiEventFieldAccess) -> Self
pub unsafe fn field_access(self, cb: jvmtiEventFieldAccess) -> Self
Set the field access callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn field_modification(self, cb: jvmtiEventFieldModification) -> Self
pub unsafe fn field_modification(self, cb: jvmtiEventFieldModification) -> Self
Set the field modification callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn method_entry(self, cb: jvmtiEventMethodEntry) -> Self
pub unsafe fn method_entry(self, cb: jvmtiEventMethodEntry) -> Self
Set the method entry callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn method_exit(self, cb: jvmtiEventMethodExit) -> Self
pub unsafe fn method_exit(self, cb: jvmtiEventMethodExit) -> Self
Set the method exit callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn native_method_bind(self, cb: jvmtiEventNativeMethodBind) -> Self
pub unsafe fn native_method_bind(self, cb: jvmtiEventNativeMethodBind) -> Self
Set the native method bind callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn compiled_method_load(
self,
cb: jvmtiEventCompiledMethodLoad,
) -> Self
pub unsafe fn compiled_method_load( self, cb: jvmtiEventCompiledMethodLoad, ) -> Self
Set the compiled method load callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn compiled_method_unload(
self,
cb: jvmtiEventCompiledMethodUnload,
) -> Self
pub unsafe fn compiled_method_unload( self, cb: jvmtiEventCompiledMethodUnload, ) -> Self
Set the compiled method unload callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn dynamic_code_generated(
self,
cb: jvmtiEventDynamicCodeGenerated,
) -> Self
pub unsafe fn dynamic_code_generated( self, cb: jvmtiEventDynamicCodeGenerated, ) -> Self
Set the dynamic code generated callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn data_dump_request(self, cb: jvmtiEventDataDumpRequest) -> Self
pub unsafe fn data_dump_request(self, cb: jvmtiEventDataDumpRequest) -> Self
Set the data dump request callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn monitor_wait(self, cb: jvmtiEventMonitorWait) -> Self
pub unsafe fn monitor_wait(self, cb: jvmtiEventMonitorWait) -> Self
Set the monitor wait callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn monitor_waited(self, cb: jvmtiEventMonitorWaited) -> Self
pub unsafe fn monitor_waited(self, cb: jvmtiEventMonitorWaited) -> Self
Set the monitor waited callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn monitor_contended_enter(
self,
cb: jvmtiEventMonitorContendedEnter,
) -> Self
pub unsafe fn monitor_contended_enter( self, cb: jvmtiEventMonitorContendedEnter, ) -> Self
Set the monitor contended enter callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn monitor_contended_entered(
self,
cb: jvmtiEventMonitorContendedEntered,
) -> Self
pub unsafe fn monitor_contended_entered( self, cb: jvmtiEventMonitorContendedEntered, ) -> Self
Set the monitor contended entered callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn garbage_collection_start(
self,
cb: jvmtiEventGarbageCollectionStart,
) -> Self
pub unsafe fn garbage_collection_start( self, cb: jvmtiEventGarbageCollectionStart, ) -> Self
Set the garbage collection start callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn garbage_collection_finish(
self,
cb: jvmtiEventGarbageCollectionFinish,
) -> Self
pub unsafe fn garbage_collection_finish( self, cb: jvmtiEventGarbageCollectionFinish, ) -> Self
Set the garbage collection finish callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn object_free(self, cb: jvmtiEventObjectFree) -> Self
pub unsafe fn object_free(self, cb: jvmtiEventObjectFree) -> Self
Set the object free callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn vm_object_alloc(self, cb: jvmtiEventVMObjectAlloc) -> Self
pub unsafe fn vm_object_alloc(self, cb: jvmtiEventVMObjectAlloc) -> Self
Set the VM object alloc callback.
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn resource_exhausted(self, cb: jvmtiEventResourceExhausted) -> Self
pub unsafe fn resource_exhausted(self, cb: jvmtiEventResourceExhausted) -> Self
Set the resource exhausted callback (JVMTI 1.1+).
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn sampled_object_alloc(
self,
cb: jvmtiEventSampledObjectAlloc,
) -> Self
pub unsafe fn sampled_object_alloc( self, cb: jvmtiEventSampledObjectAlloc, ) -> Self
Set the sampled object alloc callback (JVMTI 11+).
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn virtual_thread_start(
self,
cb: jvmtiEventVirtualThreadStart,
) -> Self
pub unsafe fn virtual_thread_start( self, cb: jvmtiEventVirtualThreadStart, ) -> Self
Set the virtual thread start callback (JVMTI 21+).
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.
Sourcepub unsafe fn virtual_thread_end(self, cb: jvmtiEventVirtualThreadEnd) -> Self
pub unsafe fn virtual_thread_end(self, cb: jvmtiEventVirtualThreadEnd) -> Self
Set the virtual thread end callback (JVMTI 21+).
§Safety
The function pointer must remain valid for the lifetime of the JVMTI environment.