Struct droid_wrap_utils::GlobalRef
source · pub struct GlobalRef { /* private fields */ }Expand description
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 and can be used in other threads.
GlobalRef can be cloned to use the same global reference in different
contexts. If you want to create yet another global ref to the same java object
you may call JNIEnv#new_global_ref just like you do when create GlobalRef
from a local reference.
Underlying global reference will be dropped, when the last instance
of GlobalRef leaves its scope.
It is recommended that a native thread that drops the global reference is attached
to the Java thread (i.e., has an instance of JNIEnv). If the native thread is not attached,
the GlobalRef#drop will print a warning and implicitly attach and detach it, which
significantly affects performance.
Implementations§
Methods from Deref<Target = JObject<'static>>§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GlobalRef
impl RefUnwindSafe for GlobalRef
impl Send for GlobalRef
impl Sync for GlobalRef
impl Unpin for GlobalRef
impl UnwindSafe for GlobalRef
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)