jvmti_rs/wrapper/descriptors/desc.rs
1use crate::errors::*;
2use jni::JNIEnv;
3
4/// see https://github.com/jni-rs/jni-rs/blob/master/src/wrapper/descriptors/desc.rs
5///
6/// Trait for things that can be looked up through the JNI via a descriptor.
7/// This will be something like the fully-qualified class name
8/// `java/lang/String` or a tuple containing a class descriptor, method name,
9/// and method signature. For convenience, this is also implemented for the
10/// concrete types themselves in addition to their descriptors.
11pub trait Desc<'a, T> {
12 /// Different
13 /// Look up the concrete type from the JVM.
14 fn lookup(self, _: &JNIEnv<'a>) -> Result<T>;
15}
16
17impl<'a, T> Desc<'a, T> for T {
18 /// Different
19 fn lookup(self, _: &JNIEnv<'a>) -> Result<T> {
20 Ok(self)
21 }
22}