Struct jni::objects::JMethodID

source ·
#[repr(transparent)]
pub struct JMethodID { /* private fields */ }
Expand description

Wrapper around jmethodID that implements Send + Sync since method IDs are valid across threads (not tied to a JNIEnv).

There is no lifetime associated with these since they aren’t garbage collected like objects and their lifetime is not implicitly connected with the scope in which they are queried.

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 jmethodID.

Safety

According to the JNI spec method IDs may be invalidated when the corresponding class is unloaded.

Since this constraint can’t be encoded as a Rust lifetime, and to avoid the excessive cost of having every Method ID be associated with a global reference to the corresponding class then it is the developers responsibility to ensure they hold some class reference for the lifetime of cached method IDs.

Implementations§

source§

impl JMethodID

source

pub unsafe fn from_raw(raw: jmethodID) -> Self

Creates a JMethodID that wraps the given raw jmethodID

Safety

Expects a valid, non-null ID

source

pub fn into_raw(self) -> jmethodID

Unwrap to the internal jni type.

Trait Implementations§

source§

impl AsMut<JMethodID> for JMethodID

source§

fn as_mut(&mut self) -> &mut JMethodID

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<JMethodID> for JMethodID

source§

fn as_ref(&self) -> &JMethodID

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for JMethodID

source§

fn clone(&self) -> JMethodID

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 Debug for JMethodID

source§

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

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

impl<'local, 'other_local, T, Signature> Desc<'local, JMethodID> for (T, Signature)where T: Desc<'local, JClass<'other_local>>, Signature: Into<JNIString>,

§

type Output = JMethodID

The type that this Desc returns.
source§

fn lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output>

Look up the concrete type from the JVM. Read more
source§

impl<'local, 'other_local, T, U, V> Desc<'local, JMethodID> for (T, U, V)where T: Desc<'local, JClass<'other_local>>, U: Into<JNIString>, V: Into<JNIString>,

§

type Output = JMethodID

The type that this Desc returns.
source§

fn lookup(self, env: &mut JNIEnv<'local>) -> Result<Self::Output>

Look up the concrete type from the JVM. Read more
source§

impl Copy for JMethodID

source§

impl Send for JMethodID

source§

impl Sync for JMethodID

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.