Struct java_spaghetti::Arg
source · pub struct Arg<T: ReferenceType> { /* private fields */ }
Expand description
FFI: Use Arg<java::lang::Object> instead of jobject. This represents a (null?) function argument.
Unlike most Java reference types from this library, this can be null.
FFI safe where a jobject is safe, assuming you match your types correctly. Using the wrong type may result in soundness issues, but at least on Android mostly seems to just result in JNI aborting execution for the current process when calling methods on an instance of the wrong type.
Implementations§
source§impl<T: ReferenceType> Arg<T>
impl<T: ReferenceType> Arg<T>
sourcepub unsafe fn from_raw(object: jobject) -> Self
pub unsafe fn from_raw(object: jobject) -> Self
unsafe: There’s no guarantee the jobject being passed is valid or null, nor any means of checking it.
pub fn as_raw(&self) -> jobject
sourcepub unsafe fn into_ref<'env>(self, env: Env<'env>) -> Option<Ref<'env, T>>
pub unsafe fn into_ref<'env>(self, env: Env<'env>) -> Option<Ref<'env, T>>
unsafe: This assumes the argument belongs to the given Env/VM, which is technically unsound. However, the intended use case of immediately converting any Arg s into ArgRef s at the start of a JNI callback, where Java directly invoked your function with an Env + arguments, is sound.
sourcepub unsafe fn into_local<'env>(self, env: Env<'env>) -> Option<Local<'env, T>>
pub unsafe fn into_local<'env>(self, env: Env<'env>) -> Option<Local<'env, T>>
unsafe: This assumes the argument belongs to the given Env/VM, which is technically unsound. However, the intended use case of immediately converting any Arg s into ArgRef s at the start of a JNI callback, where Java directly invoked your function with an Env + arguments, is sound.
sourcepub unsafe fn into_global(self, env: Env<'_>) -> Option<Global<T>>
pub unsafe fn into_global(self, env: Env<'_>) -> Option<Global<T>>
unsafe: This assumes the argument belongs to the given Env/VM, which is technically unsound. However, the intended use case of immediately converting any Arg s into ArgRef s at the start of a JNI callback, where Java directly invoked your function with an Env + arguments, is sound.