Struct jni::objects::JStaticFieldID

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

Wrapper around jfieldID that implements Send + Sync since field 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 jfieldID.

Safety

According to the JNI spec field 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 JStaticFieldID

source

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

Creates a JStaticFieldID that wraps the given raw jfieldID

Safety

Expects a valid, non-null ID

source

pub fn into_raw(self) -> jfieldID

Unwrap to the internal jni type.

Trait Implementations§

source§

impl AsMut<JStaticFieldID> for JStaticFieldID

source§

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

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

impl AsRef<JStaticFieldID> for JStaticFieldID

source§

fn as_ref(&self) -> &JStaticFieldID

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

impl Clone for JStaticFieldID

source§

fn clone(&self) -> JStaticFieldID

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 JStaticFieldID

source§

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

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

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

§

type Output = JStaticFieldID

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 JStaticFieldID

source§

impl Send for JStaticFieldID

source§

impl Sync for JStaticFieldID

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.