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],
)
| 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. |
no test coverage detected