[][src]Struct jni_glue::Global

pub struct Global<Class: AsValidJObjectAndEnv> { /* fields omitted */ }

A Global, non-null, reference to a Java object (+ &VM).

Unlike Local, this can be stored statically and shared between threads. This has a few caveats:

  • You must create a GlobalRef before use.
  • The Global can be invalidated if the VM is unloaded.

Not FFI Safe: #[repr(rust)], and exact layout is likely to change - depending on exact features used - in the future. Specifically, on Android, since we're guaranteed to only have a single ambient VM, we can likely store the *const JavaVM in static and/or thread local storage instead of lugging it around in every Local. Of course, there's no guarantee that's actually an optimization...

Methods

impl<Class: AsValidJObjectAndEnv> Global<Class>[src]

pub fn with<'env>(&'env self, env: &'env Env) -> GlobalRef<'env, Class>[src]

pub unsafe fn with_unchecked<'env>(
    &'env self,
    env: &'env Env
) -> GlobalRef<'env, Class>
[src]

Trait Implementations

impl<Class: AsValidJObjectAndEnv> Drop for Global<Class>[src]

impl<'env, Class: AsValidJObjectAndEnv> From<Local<'env, Class>> for Global<Class>[src]

impl<Class: AsValidJObjectAndEnv> Send for Global<Class>[src]

impl<Class: AsValidJObjectAndEnv> Sync for Global<Class>[src]

Auto Trait Implementations

impl<Class> RefUnwindSafe for Global<Class> where
    Class: RefUnwindSafe

impl<Class> Unpin for Global<Class> where
    Class: Unpin

impl<Class> UnwindSafe for Global<Class> where
    Class: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.