Enum JValue

Source
pub enum JValue<'a> {
    Object(JObject<'a>),
    Byte(i8),
    Char(u16),
    Short(i16),
    Int(i32),
    Long(i64),
    Bool(u8),
    Float(f32),
    Double(f64),
    Void,
}
Expand description

Rusty version of the JNI C jvalue enum. Used in Java method call arguments and returns.

Variants§

§

Object(JObject<'a>)

§

Byte(i8)

§

Char(u16)

§

Short(i16)

§

Int(i32)

§

Long(i64)

§

Bool(u8)

§

Float(f32)

§

Double(f64)

§

Void

Implementations§

Source§

impl<'a> JValue<'a>

Source

pub fn to_jni(self) -> jvalue

Convert the enum to its jni-compatible equivalent.

Source

pub fn type_name(&self) -> &'static str

Get the type name for the enum variant.

Source

pub fn primitive_type(&self) -> Option<Primitive>

Get the primitive type for the enum variant. If it’s not a primitive (i.e. an Object), returns None.

Source

pub fn l(self) -> Result<JObject<'a>, Error>

Try to unwrap to an Object.

Source

pub fn z(self) -> Result<bool, Error>

Try to unwrap to a boolean.

Source

pub fn b(self) -> Result<i8, Error>

Try to unwrap to a byte.

Source

pub fn c(self) -> Result<u16, Error>

Try to unwrap to a char.

Source

pub fn d(self) -> Result<f64, Error>

Try to unwrap to a double.

Source

pub fn f(self) -> Result<f32, Error>

Try to unwrap to a float.

Source

pub fn i(self) -> Result<i32, Error>

Try to unwrap to an int.

Source

pub fn j(self) -> Result<i64, Error>

Try to unwrap to a long.

Source

pub fn s(self) -> Result<i16, Error>

Try to unwrap to a short.

Source

pub fn v(self) -> Result<(), Error>

Try to unwrap to a void.

Trait Implementations§

Source§

impl<'a> Clone for JValue<'a>

Source§

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

Returns a duplicate 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 JValue<'a>

Source§

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

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

impl<'a> From<()> for JValue<'a>

Source§

fn from(_: ()) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<JValue<'a>> for jvalue

Source§

fn from(other: JValue<'_>) -> jvalue

Converts to this type from the input type.
Source§

impl<'a, T> From<T> for JValue<'a>
where T: Into<JObject<'a>>,

Source§

fn from(other: T) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<bool> for JValue<'a>

Source§

fn from(other: bool) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<f32> for JValue<'a>

Source§

fn from(other: f32) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<f64> for JValue<'a>

Source§

fn from(other: f64) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<i16> for JValue<'a>

Source§

fn from(other: i16) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<i32> for JValue<'a>

Source§

fn from(other: i32) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<i64> for JValue<'a>

Source§

fn from(other: i64) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<i8> for JValue<'a>

Source§

fn from(other: i8) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<u16> for JValue<'a>

Source§

fn from(other: u16) -> JValue<'a>

Converts to this type from the input type.
Source§

impl<'a> From<u8> for JValue<'a>

Source§

fn from(other: u8) -> JValue<'a>

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> Copy for JValue<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for JValue<'a>

§

impl<'a> RefUnwindSafe for JValue<'a>

§

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

§

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

§

impl<'a> Unpin for JValue<'a>

§

impl<'a> UnwindSafe for JValue<'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<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.