polyhorn_android_sys/reference.rs
1use jni::objects::{GlobalRef, JObject};
2
3use super::VM;
4
5pub struct Reference {
6 pub(crate) global_ref: GlobalRef,
7 pub(crate) vm: VM,
8}
9
10impl Reference {
11 pub fn as_object(&self) -> JObject {
12 self.global_ref.as_obj()
13 }
14
15 pub fn vm(&self) -> &VM {
16 &self.vm
17 }
18}
19
20impl Clone for Reference {
21 fn clone(&self) -> Self {
22 Reference {
23 global_ref: self.global_ref.clone(),
24 vm: self.vm.internal_clone(),
25 }
26 }
27}