jvmti_rs/wrapper/metadata/
jthread_group_info.rs

1use crate::{objects::*, stringify};
2
3use std::marker::PhantomData;
4use crate::sys::jvmtiThreadGroupInfo;
5
6#[derive(Clone, Debug)]
7pub struct JThreadGroupInfo<'a> {
8    internal: jvmtiThreadGroupInfo,
9    lifetime: PhantomData<&'a ()>,
10
11    pub parent: JThreadGroupID<'a>,
12    pub name: String,
13    pub max_priority: u32,
14    pub is_daemon: bool,
15}
16
17impl<'a> JThreadGroupInfo<'a> {
18    pub fn new(info: jvmtiThreadGroupInfo) -> JThreadGroupInfo<'a> {
19        JThreadGroupInfo {
20            internal: info,
21            lifetime: PhantomData,
22
23            parent: info.parent.into(),
24            name: stringify(info.name),
25            max_priority: info.max_priority as u32,
26            is_daemon: if info.is_daemon > 0 { true } else { false },
27        }
28    }
29}
30
31impl<'a> ::std::ops::Deref for JThreadGroupInfo<'a> {
32    type Target = jvmtiThreadGroupInfo;
33
34    fn deref(&self) -> &Self::Target {
35        &self.internal
36    }
37}