pub enum JValueGen<O> {
Object(O),
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.
JValueGen
is a generic type, meant to represent both owned and borrowed
JNI values. The type parameter O
refers to what kind of object reference
the JValueGen
can hold, which is either:
- an owned
JObject
, used for values returned from a Java method call, or - a borrowed
&JObject
, used for parameters passed to a Java method call.
These two cases are represented by the type aliases JValueOwned
and
JValue
, respectively.
Variants§
Implementations§
Source§impl<O> JValueGen<O>
impl<O> JValueGen<O>
Sourcepub fn to_jni<'local>(self) -> jvalue
👎Deprecated: Use as_jni
instead.
pub fn to_jni<'local>(self) -> jvalue
as_jni
instead.Convert the enum to its jni-compatible equivalent.
Sourcepub fn primitive_type(&self) -> Option<Primitive>
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.
Trait Implementations§
impl<O> Copy for JValueGen<O>where
O: Copy,
Auto Trait Implementations§
impl<O> Freeze for JValueGen<O>where
O: Freeze,
impl<O> RefUnwindSafe for JValueGen<O>where
O: RefUnwindSafe,
impl<O> Send for JValueGen<O>where
O: Send,
impl<O> Sync for JValueGen<O>where
O: Sync,
impl<O> Unpin for JValueGen<O>where
O: Unpin,
impl<O> UnwindSafe for JValueGen<O>where
O: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more