MCPcopy Create free account
hub / github.com/deviceplug/btleplug / waker

Function waker

src/droidplug/jni_utils/task.rs:10–23  ·  view source on GitHub ↗

Wraps the given waker in a `io.github.gedgygedgy.rust.task.Waker` object.

(env: &'b JNIEnv<'a>, waker: Waker)

Source from the content-addressed store, hash-verified

8
9/// Wraps the given waker in a `io.github.gedgygedgy.rust.task.Waker` object.
10pub 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`.

Callers 4

poll_next_internalMethod · 0.85
poll_internalMethod · 0.85
test_waker_wakeFunction · 0.85
test_waker_close_wakeFunction · 0.85

Calls 2

get_classFunction · 0.85
wakeMethod · 0.45

Tested by 2

test_waker_wakeFunction · 0.68
test_waker_close_wakeFunction · 0.68