Struct JObject

Source
pub struct JObject<'a> { /* private fields */ }
Expand description

Wrapper around sys::jobject that adds a lifetime. This prevents it from outliving the context in which it was acquired and getting GC’d out from under us. It matches C’s representation of the raw pointer, so it can be used in any of the extern function argument positions that would take a jobject.

Most other types in the objects module deref to this, as they do in the C representation.

Implementations§

Source§

impl<'a> JObject<'a>

Source

pub fn into_inner(self) -> *mut _jobject

Unwrap to the internal jni type.

Source

pub fn null() -> JObject<'a>

Creates a new null object

Trait Implementations§

Source§

impl<'a> AutoDeallocateBuilder<'a, JObject<'a>> for MutAutoDeallocateObjectArrayBuilder<jobject>

Source§

fn build(&self, jvmti: &'a JVMTIEnv<'a>) -> Vec<JObject<'a>>

Source§

impl<'a> Clone for JObject<'a>

Source§

fn clone(&self) -> JObject<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for JObject<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> Desc<'a, JClass<'a>> for JObject<'a>

Source§

fn lookup(self, jni: &JNIEnv<'a>) -> Result<JClass<'a>>

Different Look up the concrete type from the JVM.
Source§

impl<'a, 'b> Desc<'a, JClass<'a>> for JObject<'b>

Source§

fn lookup(self, env: &JNIEnv<'a>) -> Result<JClass<'a>, Error>

Look up the concrete type from the JVM.
Source§

impl<'a> From<&'a AutoLocal<'a, '_>> for JObject<'a>

Source§

fn from(other: &'a AutoLocal<'_, '_>) -> JObject<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a GlobalRef> for JObject<'a>

Source§

fn from(other: &'a GlobalRef) -> JObject<'a>

Converts to this type from the input type.
Source§

impl<'a> From<*mut _jobject> for JObject<'a>

Source§

fn from(other: *mut _jobject) -> JObject<'a>

Converts to this type from the input type.
Source§

impl<'a> From<JByteBuffer<'a>> for JObject<'a>

Source§

fn from(other: JByteBuffer<'_>) -> JObject<'_>

Converts to this type from the input type.
Source§

impl<'a> From<JClass<'a>> for JObject<'a>

Source§

fn from(other: JClass<'_>) -> JObject<'_>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<JList<'a, 'b>> for JObject<'a>
where 'a: 'b,

Source§

fn from(other: JList<'a, 'b>) -> JObject<'a>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<JMap<'a, 'b>> for JObject<'a>
where 'a: 'b,

Source§

fn from(other: JMap<'a, 'b>) -> JObject<'a>

Converts to this type from the input type.
Source§

impl<'a> From<JObject<'a>> for JByteBuffer<'a>

Source§

fn from(other: JObject<'_>) -> JByteBuffer<'_>

Converts to this type from the input type.
Source§

impl<'a> From<JObject<'a>> for JClass<'a>

This conversion assumes that the JObject is a pointer to a class object.

Source§

fn from(other: JObject<'_>) -> JClass<'_>

Converts to this type from the input type.
Source§

impl<'a> From<JObject<'a>> for JString<'a>

Source§

fn from(other: JObject<'_>) -> JString<'_>

Converts to this type from the input type.
Source§

impl<'a> From<JObject<'a>> for JThrowable<'a>

Source§

fn from(other: JObject<'_>) -> JThrowable<'_>

Converts to this type from the input type.
Source§

impl<'a> From<JString<'a>> for JObject<'a>

Source§

fn from(other: JString<'_>) -> JObject<'_>

Converts to this type from the input type.
Source§

impl<'a> From<JThrowable<'a>> for JObject<'a>

Source§

fn from(other: JThrowable<'_>) -> JObject<'_>

Converts to this type from the input type.
Source§

impl<'a> TryFrom<JValue<'a>> for JObject<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: JValue<'a>) -> Result<JObject<'a>, Error>

Performs the conversion.
Source§

impl<'a> Deref for JObject<'a>

Source§

type Target = *mut _jobject

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<JObject<'a> as Deref>::Target

Dereferences the value.
Source§

impl<'a> Copy for JObject<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for JObject<'a>

§

impl<'a> RefUnwindSafe for JObject<'a>

§

impl<'a> !Send for JObject<'a>

§

impl<'a> !Sync for JObject<'a>

§

impl<'a> Unpin for JObject<'a>

§

impl<'a> UnwindSafe for JObject<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'a, T> Desc<'a, T> for T

Source§

fn lookup(self, _: &JNIEnv<'a>) -> Result<T, Error>

Different

Source§

impl<'a, T> Desc<'a, T> for T

Source§

fn lookup(self, _: &JNIEnv<'a>) -> Result<T, Error>

Look up the concrete type from the JVM.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.