Struct jni::objects::GlobalRef
[−]
[src]
pub struct GlobalRef { /* fields omitted */ }
A global JVM reference. These are "pinned" by the garbage collector and are
guaranteed to not get collected until released. Thus, this is allowed to
outlive the JNIEnv
that it came from. Still can't cross thread boundaries
since it requires a pointer to the JNIEnv
to do anything useful with it.
Methods
impl GlobalRef
[src]
unsafe fn new(env: *mut JNIEnv, obj: jobject) -> Self
[src]
Create a new global reference object. This assumes that
CreateGlobalRef
has already been called.
fn as_obj<'a>(&'a self) -> JObject<'a>
[src]
Get the object from the global ref
This borrows the ref and prevents it from being dropped as long as the JObject sticks around.
Trait Implementations
impl<'a, 'b> Desc<'a, JClass<'b>> for &'b GlobalRef
[src]
This conversion assumes that the GlobalRef
is a pointer to a class object.