aboutsummaryrefslogtreecommitdiff
path: root/src/wrapper/descriptors/field_desc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrapper/descriptors/field_desc.rs')
-rw-r--r--src/wrapper/descriptors/field_desc.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/wrapper/descriptors/field_desc.rs b/src/wrapper/descriptors/field_desc.rs
new file mode 100644
index 0000000..cdaf908
--- /dev/null
+++ b/src/wrapper/descriptors/field_desc.rs
@@ -0,0 +1,29 @@
+use crate::{
+ descriptors::Desc,
+ errors::*,
+ objects::{JClass, JFieldID, JStaticFieldID},
+ strings::JNIString,
+ JNIEnv,
+};
+
+impl<'a, 'c, T, U, V> Desc<'a, JFieldID<'a>> for (T, U, V)
+where
+ T: Desc<'a, JClass<'c>>,
+ U: Into<JNIString>,
+ V: Into<JNIString>,
+{
+ fn lookup(self, env: &JNIEnv<'a>) -> Result<JFieldID<'a>> {
+ env.get_field_id(self.0, self.1, self.2)
+ }
+}
+
+impl<'a, 'c, T, U, V> Desc<'a, JStaticFieldID<'a>> for (T, U, V)
+where
+ T: Desc<'a, JClass<'c>>,
+ U: Into<JNIString>,
+ V: Into<JNIString>,
+{
+ fn lookup(self, env: &JNIEnv<'a>) -> Result<JStaticFieldID<'a>> {
+ env.get_static_field_id(self.0, self.1, self.2)
+ }
+}