pub fn to_static_waker<T: DynamicWake + Sync + 'static>(wake: &'static T)->Waker{
    struct Helper<T>(T);
    impl<T: DynamicWake + Sync + 'static> Helper<T> {
        const VTABLE: RawWakerVTable = RawWakerVTable::new(
            Self::waker_clone,
            Self::waker_wake,
            Self::waker_wake,
            dummy,
        );
        //SAFETY: ptr is always &'static T
        unsafe fn waker_clone(ptr: *const ()) -> RawWaker {
            RawWaker::new(ptr, &Self::VTABLE)
        }
        //SAFETY: ptr is always &'static T
        unsafe fn waker_wake(ptr: *const ()) {
            (*(ptr as *const T)).wake();
        }
    }
    //VTABLE is constant, using waker_clone reduces chance of making 2 copies in static memory
    unsafe { Waker::from_raw(Helper::<T>::waker_clone(wake as *const T as *const ())) }
}
/// Convert static reference to type implementing [`DynamicWake`](trait.DynamicWake.html)
/// into Waker.
///
/// Returned waker wraps given static reference and is safe to `mem::forget` without leak.
/// This method also doesn't perform any allocations.
Convert static reference to type implementing [`DynamicWake`](trait.DynamicWake.html)
into Waker.

Returned waker wraps given static reference and is safe to `mem::forget` without leak.
This method also doesn't perform any allocations.
Convert static reference to type implementing [ ` DynamicWake ` ] ( trait . DynamicWake . html ) into Waker . Returned waker wraps given static reference and is safe to ` mem :: forget ` without leak . This method also doesn ' t perform any allocations .
pub fn to_static_waker<T: DynamicWake + Sync + 'static>(wake: &'static T)->Waker{
    struct Helper<T>(T);
    impl<T: DynamicWake + Sync + 'static> Helper<T> {
        const VTABLE: RawWakerVTable = RawWakerVTable::new(
            Self::waker_clone,
            Self::waker_wake,
            Self::waker_wake,
            dummy,
        );
        //SAFETY: ptr is always &'static T
        unsafe fn waker_clone(ptr: *const ()) -> RawWaker {
            RawWaker::new(ptr, &Self::VTABLE)
        }
        //SAFETY: ptr is always &'static T
        unsafe fn waker_wake(ptr: *const ()) {
            (*(ptr as *const T)).wake();
        }
    }
    //VTABLE is constant, using waker_clone reduces chance of making 2 copies in static memory
    unsafe { Waker::from_raw(Helper::<T>::waker_clone(wake as *const T as *const ())) }
}
pub fn to_static_waker < T : DynamicWake + Sync + ' static > ( wake : & ' static T ) -> Waker { struct Helper < T > ( T ) ; impl < T : DynamicWake + Sync + ' static > Helper < T > { const VTABLE : RawWakerVTable = RawWakerVTable :: new ( Self :: waker_clone , Self :: waker_wake , Self :: waker_wake , dummy , ) ; //SAFETY: ptr is always &'static T unsafe fn waker_clone ( ptr : * const ( ) ) -> RawWaker { RawWaker :: new ( ptr , & Self :: VTABLE ) } //SAFETY: ptr is always &'static T unsafe fn waker_wake ( ptr : * const ( ) ) { ( * ( ptr as * const T ) ) . wake ( ) ; } } //VTABLE is constant, using waker_clone reduces chance of making 2 copies in static memory unsafe { Waker :: from_raw ( Helper :: < T > :: waker_clone ( wake as * const T as * const ( ) ) ) } }
Convert static reference to type implementing [`DynamicWake`](trait.DynamicWake.html)
into Waker.
Convert static reference to type implementing [ ` DynamicWake ` ] ( trait . DynamicWake . html ) into Waker .
wake
&'static T
wake
&'static T