futures_test::task

Function new_count_waker

source
pub fn new_count_waker() -> (Waker, AwokenCount)
Expand description

Create a new Waker that counts the number of times it’s awoken.

§Examples

use futures_test::task::new_count_waker;

let (waker, count) = new_count_waker();

assert_eq!(count, 0);

waker.wake_by_ref();
waker.wake();

assert_eq!(count, 2);