MCPcopy Create free account
hub / github.com/async-rs/async-task / schedule

Function schedule

tests/basic.rs:241–262  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

239
240#[test]
241fn schedule() {
242 let (s, r) = channel::unbounded();
243 let schedule = move |t| s.send(t).unwrap();
244 let (task, _handle) = async_task::spawn(
245 future::poll_fn(|_| Poll::<()>::Pending),
246 schedule,
247 Box::new(0),
248 );
249
250 assert!(r.is_empty());
251 task.schedule();
252
253 let task = r.recv().unwrap();
254 assert!(r.is_empty());
255 task.schedule();
256
257 let task = r.recv().unwrap();
258 assert!(r.is_empty());
259 task.schedule();
260
261 r.recv().unwrap();
262}
263
264#[test]
265fn tag() {

Callers 3

wakeMethod · 0.85
drop_wakerMethod · 0.85
runMethod · 0.85

Calls 2

spawnFunction · 0.50
scheduleMethod · 0.45

Tested by

no test coverage detected