jvmti_rs/wrapper/objects/
jconstant_pool.rs1use crate::{objects::*, JVMTIEnv};
2use std::marker::PhantomData;
3use crate::sys::{jint, jmemory};
4use jni_sys::jlong;
5
6pub struct JConstantPool<'a> {
7 lifetime: PhantomData<&'a ()>,
8
9 pub count: u32,
10 pub bytes: JMemoryAllocate<'a>,
11}
12
13impl<'a> JConstantPool<'a> {
14 pub fn new<'b: 'a>(constant_pool_count: jint,
15 constant_pool_byte_count: jint,
16 constant_pool_bytes: jmemory,
17 env: &'b JVMTIEnv<'a>) -> JConstantPool<'a> {
18 let bytes = JMemoryAllocate::new(constant_pool_bytes, constant_pool_byte_count as jlong, env);
19
20 JConstantPool {
21 lifetime: PhantomData,
22 count: constant_pool_count as u32,
23 bytes,
24 }
25 }
26}
27
28impl<'a> Drop for JConstantPool<'a> {
29 fn drop(&mut self) {
30 let bytes = &mut self.bytes;
31 bytes.deallocate()
32 }
33}