Macro wookie::wookie [−][src]
macro_rules! wookie {
($name : ident) => { ... };
($name : ident : $future : expr) => { ... };
}
Expand description
Wraps a future in a single-future stepping executor for test suites that tracks wakers and pins it on the stack.
Examples
use core::task::Poll;
use wookie::wookie;
wookie!(future: async { true });
assert_eq!(future.poll(), Poll::Ready(true));
// you can also just give a variable name if you have one:
let future = async { true };
wookie!(future);
assert_eq!(future.poll(), Poll::Ready(true));
// we can find out about the state of wakers any time:
assert_eq!(future.cloned(), 0);
assert_eq!(future.dropped(), 0);
assert_eq!(future.woken(), 0);
// or equivalently...
future.stats().assert(0, 0, 0);