pub enum JValueGen<O> {
Object(O),
Byte(jbyte),
Char(jchar),
Short(jshort),
Int(jint),
Long(jlong),
Bool(jboolean),
Float(jfloat),
Double(jdouble),
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§
Object(O)
Byte(jbyte)
Char(jchar)
Short(jshort)
Int(jint)
Long(jlong)
Bool(jboolean)
Float(jfloat)
Double(jdouble)
Void
Implementations§
source§impl<O> JValueGen<O>
impl<O> JValueGen<O>
sourcepub fn as_jni<'local>(&self) -> jvaluewhere
O: AsRef<JObject<'local>> + Debug,
pub fn as_jni<'local>(&self) -> jvaluewhere O: AsRef<JObject<'local>> + Debug,
Convert the enum to its jni-compatible equivalent.
sourcepub fn to_jni<'local>(self) -> jvaluewhere
O: AsRef<JObject<'local>> + Debug,
👎Deprecated: Use <code>as_jni</code> instead.
pub fn to_jni<'local>(self) -> jvaluewhere O: AsRef<JObject<'local>> + Debug,
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.