1
2
3
4
5
6
7
8
9
10
11
12
13
14
use core::task::{RawWaker, RawWakerVTable, Waker};

/// A Waker that doesn't do anything.
pub fn dummy_waker() -> Waker {
    fn new_raw_waker() -> RawWaker {
        unsafe fn no_op(_data: *const ()) {}
        unsafe fn clone(_data: *const ()) -> RawWaker {
            new_raw_waker()
        }
        static VTABLE: RawWakerVTable = RawWakerVTable::new(clone, no_op, no_op, no_op);
        RawWaker::new(core::ptr::null(), &VTABLE)
    }
    unsafe { Waker::from_raw(new_raw_waker()) }
}