Skip to main content

EventCallbacksBuilder

Struct EventCallbacksBuilder 

Source
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

Source

pub fn new() -> Self

Creates a new empty builder.

Source

pub fn as_raw(&self) -> &jvmtiEventCallbacks

Returns the raw callbacks struct.

Source

pub fn into_raw(self) -> jvmtiEventCallbacks

Consumes the builder and returns the raw callbacks struct.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for EventCallbacksBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EventCallbacksBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.