[][src]Enum j4rs::InvocationArg

pub enum InvocationArg {
    Java {
        instance: Instance,
        class_name: String,
        serialized: bool,
    },
    Rust {
        json: String,
        class_name: String,
        serialized: bool,
    },
    RustBasic {
        instance: Instance,
        class_name: String,
        serialized: bool,
    },
}

Struct that carries an argument that is used for method invocations in Java.

Variants

Java

An arg that is created in the Java world.

Fields of Java

instance: Instanceclass_name: Stringserialized: bool
Rust

A serialized arg that is created in the Rust world.

Fields of Rust

json: Stringclass_name: Stringserialized: bool
RustBasic

An non-serialized arg created in the Rust world, that contains a Java instance.

The instance is a Basic Java type, like Integer, Float, String etc.

Fields of RustBasic

instance: Instanceclass_name: Stringserialized: bool

Implementations

impl InvocationArg[src]

pub fn new<T>(arg: &T, class_name: &str) -> InvocationArg where
    T: Serialize + Any
[src]

Creates a InvocationArg::Rust. This is default for the Args that are created from the Rust code.

pub fn new_2<T>(
    arg: &T,
    class_name: &str,
    jni_env: *mut JNIEnv
) -> Result<InvocationArg> where
    T: Serialize + Any
[src]

pub fn into_primitive(self) -> Result<InvocationArg>[src]

Consumes this InvocationArg and transforms it to an InvocationArg that contains a Java primitive, leveraging Java's autoboxing.

This action can be done by calling Jvm::cast of Instances as well (e.g.: jvm.cast(&instance, "int")) but calling into_primitive is faster, as it does not involve JNI calls.

pub fn as_java_ptr_with_global_ref(
    &self,
    jni_env: *mut JNIEnv
) -> Result<jobject>
[src]

Creates a jobject from this InvocationArg.

pub fn as_java_ptr_with_local_ref(
    &self,
    jni_env: *mut JNIEnv
) -> Result<jobject>
[src]

Creates a jobject from this InvocationArg. The jobject contains a local reference.

pub fn instance(self) -> Result<Instance>[src]

Consumes this invocation arg and returns its Instance

pub fn class_name(&self) -> &str[src]

pub fn create_null(null: Null<'_>) -> Result<InvocationArg>[src]

Creates an InvocationArg that contains null

Trait Implementations

impl From<Instance> for InvocationArg[src]

impl Serialize for InvocationArg[src]

impl<'a> TryFrom<&'a [&'a str]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [String]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [bool]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [char]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [f32]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [f64]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [i16]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [i32]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [i64]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a [i8]> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a String> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a bool> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a char> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a f32> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a f64> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a i16> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a, 'b> TryFrom<&'a i32> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a i64> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a i8> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a str> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a, T: 'static> TryFrom<(&'a [T], &'a str)> for InvocationArg where
    T: Serialize
[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<()> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<InvocationArg> for Instance[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl<'a> TryFrom<Null<'a>> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<String> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<bool> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<char> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<f32> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<f64> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<i16> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<i32> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<i64> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

impl TryFrom<i8> for InvocationArg[src]

type Error = J4RsError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.