jvmti_rs/wrapper/descriptors/
method_desc.rs

1use crate::*;
2use crate::{objects::*, errors::*};
3use jni::strings::JNIString;
4use jni::JNIEnv;
5
6impl<'a, U, V> Desc<'a, JMethodID<'a>> for (JClass<'a>, U, V)
7    where
8        U: Into<JNIString>,
9        V: Into<JNIString>, {
10    fn lookup(self, jni: &JNIEnv<'a>) -> Result<JMethodID<'a>> {
11        jni.get_method_id(self.0, self.1, self.2)
12            .map_err(jni_lookup_error)
13    }
14}
15
16impl<'a, U> Desc<'a, JMethodID<'a>> for (JClass<'a>, U)
17    where
18        U: Into<JNIString>, {
19    fn lookup(self, jni: &JNIEnv<'a>) -> Result<JMethodID<'a>> {
20        (self.0, "<init>", self.1).lookup(jni)
21    }
22}
23
24impl<'a, U, V> Desc<'a, JStaticMethodID<'a>> for (JClass<'a>, U, V)
25    where
26        U: Into<JNIString>,
27        V: Into<JNIString>, {
28    fn lookup(self, jni: &JNIEnv<'a>) -> Result<JStaticMethodID<'a>> {
29        jni.get_static_method_id(self.0, self.1, self.2)
30            .map_err(jni_lookup_error)
31    }
32}