Struct java_spaghetti::Ref
source · pub struct Ref<'env, T: ReferenceType> { /* private fields */ }
Expand description
A non-null, reference to a Java object (+ Env). This may refer to a Local, Global, local Arg, etc.
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 JNIEnv in thread local storage instead of lugging it around in every Local. Of course, there’s no guarantee that’s actually an optimization…
Implementations§
source§impl<'env, T: ReferenceType> Ref<'env, T>
impl<'env, T: ReferenceType> Ref<'env, T>
pub unsafe fn from_raw(env: Env<'env>, object: jobject) -> Self
pub fn env(&self) -> Env<'env>
pub fn as_raw(&self) -> jobject
pub fn as_global(&self) -> Global<T>
pub fn as_local(&self) -> Local<'env, T>
pub fn cast<U: ReferenceType>(&self) -> Result<Ref<'env, U>, CastError>
pub fn upcast<U: ReferenceType>(&self) -> Ref<'env, U>where
Self: AssignableTo<U>,
Trait Implementations§
source§impl<T: ReferenceType, U: AssignableTo<T>> AsArg<T> for Ref<'_, U>
impl<T: ReferenceType, U: AssignableTo<T>> AsArg<T> for Ref<'_, U>
impl<'env, T: ReferenceType> Copy for Ref<'env, T>
Auto Trait Implementations§
impl<'env, T> Freeze for Ref<'env, T>where
T: JniType + 'static,
impl<'env, T> RefUnwindSafe for Ref<'env, T>where
T: JniType + 'static + RefUnwindSafe,
impl<'env, T> !Send for Ref<'env, T>
impl<'env, T> !Sync for Ref<'env, T>
impl<'env, T> Unpin for Ref<'env, T>where
T: JniType + 'static,
impl<'env, T> !UnwindSafe for Ref<'env, T>
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
Mutably borrows from an owned value. Read more