[−][src]Struct j4rs::Jvm
Holds the assets for the JVM
Methods
impl Jvm
[src]
pub fn new(
jvm_options: &[String],
lib_name_to_load: Option<String>
) -> Result<Jvm>
[src]
jvm_options: &[String],
lib_name_to_load: Option<String>
) -> Result<Jvm>
Creates a new Jvm.
pub fn attach_thread() -> Result<Jvm>
[src]
Attaches the current thread to an active JavaVM
pub fn detach_thread_on_drop(&mut self, detach: bool)
[src]
If true, the thread will not be detached when the Jvm is eing dropped. This is useful when creating a Jvm while on a Thread that is created in the Java world. When this Jvm is dropped, we don't want to detach the thread from the Java VM.
It prevents errors like: attempting to detach while still running code
pub fn try_from(jni_environment: *mut JNIEnv) -> Result<Jvm>
[src]
pub fn create_instance(
&self,
class_name: &str,
inv_args: &[InvocationArg]
) -> Result<Instance>
[src]
&self,
class_name: &str,
inv_args: &[InvocationArg]
) -> Result<Instance>
Creates an Instance
of the class class_name
, passing an array of InvocationArg
s to construct the instance.
pub fn invoke(
&self,
instance: &Instance,
method_name: &str,
inv_args: &[InvocationArg]
) -> Result<Instance>
[src]
&self,
instance: &Instance,
method_name: &str,
inv_args: &[InvocationArg]
) -> Result<Instance>
Invokes the method method_name
of a created Instance
, passing an array of InvocationArg
s. It returns an Instance
as the result of the invocation.
pub fn invoke_async(
&self,
instance: &Instance,
method_name: &str,
inv_args: &[InvocationArg],
callback: Callback
) -> Result<()>
[src]
&self,
instance: &Instance,
method_name: &str,
inv_args: &[InvocationArg],
callback: Callback
) -> Result<()>
please use invoke_to_channel
instead
Invokes asynchronously the method method_name
of a created Instance
, passing an array of InvocationArg
s.
It returns void and the Instance
of the result of the async invocation will come in the defined callback.
pub fn invoke_to_channel(
&self,
instance: &Instance,
method_name: &str,
inv_args: &[InvocationArg]
) -> Result<InstanceReceiver>
[src]
&self,
instance: &Instance,
method_name: &str,
inv_args: &[InvocationArg]
) -> Result<InstanceReceiver>
Invokes the method method_name
of a created Instance
, passing an array of InvocationArg
s.
It returns a Result of InstanceReceiver
that may be used to get an underlying Receiver<Instance>
. The result of the invocation will come via this Receiver.
pub fn init_callback_channel(
&self,
instance: &Instance
) -> Result<InstanceReceiver>
[src]
&self,
instance: &Instance
) -> Result<InstanceReceiver>
pub fn invoke_static(
&self,
class_name: &str,
method_name: &str,
inv_args: &[InvocationArg]
) -> Result<Instance>
[src]
&self,
class_name: &str,
method_name: &str,
inv_args: &[InvocationArg]
) -> Result<Instance>
Invokes the static method method_name
of the class class_name
, passing an array of InvocationArg
s. It returns an Instance
as the result of the invocation.
pub fn clone_instance(&self, instance: &Instance) -> Result<Instance>
[src]
Creates a clone of the provided Instance
pub fn cast(&self, from_instance: &Instance, to_class: &str) -> Result<Instance>
[src]
Invokes the static method method_name
of the class class_name
, passing an array of InvocationArg
s. It returns an Instance
as the result of the invocation.
pub fn to_rust<T>(&self, instance: Instance) -> Result<T> where
T: DeserializeOwned,
[src]
T: DeserializeOwned,
Returns the Rust representation of the provided instance
pub fn to_rust_string(&self, java_string: jstring) -> Result<String>
[src]
Trait Implementations
impl Clone for Jvm
[src]
fn clone(&self) -> Jvm
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Drop for Jvm
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,