MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / invoke_async

Method invoke_async

rust/src/async_api/mod.rs:29–49  ·  view source on GitHub ↗

Invokes the method `method_name` of a created `Instance` asynchronously, passing an array of `InvocationArg`s. It returns an `Instance` as the result of the invocation.

(
        &self,
        instance: &Instance,
        method_name: &str,
        inv_args: &[InvocationArg],
    )

Source from the content-addressed store, hash-verified

27 /// Invokes the method `method_name` of a created `Instance` asynchronously, passing an array of `InvocationArg`s.
28 /// It returns an `Instance` as the result of the invocation.
29 pub async fn invoke_async(
30 &self,
31 instance: &Instance,
32 method_name: &str,
33 inv_args: &[InvocationArg],
34 ) -> errors::Result<Instance> {
35 debug(&format!(
36 "Asynchronously invoking method {} of class {} using {} arguments",
37 method_name,
38 instance.class_name,
39 inv_args.len()
40 ));
41 // Create the channel
42 let (sender, rx) = oneshot::channel::<errors::Result<Instance>>();
43 unsafe {
44 Self::handle_channel_sender(self, sender, instance, method_name, inv_args)?;
45 }
46 // Create and return the Instance
47 let instance = rx.await?;
48 Self::do_return(self.jni_env, instance)?
49 }
50
51 /// Invokes the method `method_name` of a created `Instance` asynchronously, passing an array of `InvocationArg`s.
52 /// It returns an `Instance` as the result of the invocation.

Calls 2

debugFunction · 0.85
do_returnFunction · 0.85

Tested by

no test coverage detected