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