Wraps the given waker in a `io.github.gedgygedgy.rust.task.Waker` object.
(env: &'b JNIEnv<'a>, waker: Waker)
| 8 | |
| 9 | /// Wraps the given waker in a `io.github.gedgygedgy.rust.task.Waker` object. |
| 10 | pub fn waker<'a: 'b, 'b>(env: &'b JNIEnv<'a>, waker: Waker) -> Result<JObject<'a>> { |
| 11 | let runnable = super::ops::fn_once_runnable(env, |_e, _o| waker.wake())?; |
| 12 | |
| 13 | let obj = env.new_object( |
| 14 | JClass::from( |
| 15 | super::classcache::get_class("io/github/gedgygedgy/rust/task/Waker") |
| 16 | .unwrap() |
| 17 | .as_obj(), |
| 18 | ), |
| 19 | "(Lio/github/gedgygedgy/rust/ops/FnRunnable;)V", |
| 20 | &[runnable.into()], |
| 21 | )?; |
| 22 | Ok(obj) |
| 23 | } |
| 24 | |
| 25 | /// Wrapper for [`JObject`]s that implement |
| 26 | /// `io.github.gedgygedgy.rust.task.PollResult`. |