1 use crate::{ 2 descriptors::Desc, 3 errors::*, 4 objects::{JClass, JMethodID, JStaticMethodID}, 5 strings::JNIString, 6 JNIEnv, 7 }; 8 9 unsafe impl<'local, 'other_local, T, U, V> Desc<'local, JMethodID> for (T, U, V) 10 where 11 T: Desc<'local, JClass<'other_local>>, 12 U: Into<JNIString>, 13 V: Into<JNIString>, 14 { 15 type Output = JMethodID; 16 lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output>17 fn lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output> { 18 env.get_method_id(self.0, self.1, self.2) 19 } 20 } 21 22 unsafe impl<'local, 'other_local, T, Signature> Desc<'local, JMethodID> for (T, Signature) 23 where 24 T: Desc<'local, JClass<'other_local>>, 25 Signature: Into<JNIString>, 26 { 27 type Output = JMethodID; 28 lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output>29 fn lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output> { 30 Desc::<JMethodID>::lookup((self.0, "<init>", self.1), env) 31 } 32 } 33 34 unsafe impl<'local, 'other_local, T, U, V> Desc<'local, JStaticMethodID> for (T, U, V) 35 where 36 T: Desc<'local, JClass<'other_local>>, 37 U: Into<JNIString>, 38 V: Into<JNIString>, 39 { 40 type Output = JStaticMethodID; 41 lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output>42 fn lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output> { 43 env.get_static_method_id(self.0, self.1, self.2) 44 } 45 } 46