pub async fn timer_should_wake_up_local( exec: impl LocalSpawnHandle<()> + Clone + Timer + 'static )
{
	let ex2    = exec.clone();
	let handle = exec.spawn_handle_local( async move
	{
		let fast = ex2.sleep( Duration::from_millis( 1) ).fuse();
		let slow = ex2.sleep( Duration::from_millis(80) ).fuse();

		futures_util::pin_mut!( fast );
		futures_util::pin_mut!( slow );

		let res = futures_util::select!
		{
			_ = slow => false,
			_ = fast => true,
		};

		assert!( res );

	}).expect( "spawn_handle" );

	handle.await;
}
// Verify timers work by making sure a shorter timer ends before the longer one.
// On top of that this shouldn't hang.
//
// This one is needed for executors that aren't Send, because we pass the executor into
// the spawned task and ThreadPools don't implement spawning !Send futures.
//
Verify timers work by making sure a shorter timer ends before the longer one.
On top of that this shouldn't hang.

This one is needed for executors that aren't Send, because we pass the executor into
the spawned task and ThreadPools don't implement spawning !Send futures.
Verify timers work by making sure a shorter timer ends before the longer one . On top of that this shouldn ' t hang . This one is needed for executors that aren ' t Send because we pass the executor into the spawned task and ThreadPools don ' t implement spawning !Send futures .
pub async fn timer_should_wake_up_local( exec: impl LocalSpawnHandle<()> + Clone + Timer + 'static )
{
	let ex2    = exec.clone();
	let handle = exec.spawn_handle_local( async move
	{
		let fast = ex2.sleep( Duration::from_millis( 1) ).fuse();
		let slow = ex2.sleep( Duration::from_millis(80) ).fuse();
		futures_util::pin_mut!( fast );
		futures_util::pin_mut!( slow );
		let res = futures_util::select!
		{
			_ = slow => false,
			_ = fast => true,
		};
		assert!( res );
	}).expect( "spawn_handle" );
	handle.await;
}
pub async fn timer_should_wake_up_local ( exec : impl LocalSpawnHandle < ( ) > + Clone + Timer + ' static ) { let ex2 = exec . clone ( ) ; let handle = exec . spawn_handle_local ( async move { let fast = ex2 . sleep ( Duration :: from_millis ( 1 ) ) . fuse ( ) ; let slow = ex2 . sleep ( Duration :: from_millis ( 80 ) ) . fuse ( ) ; futures_util :: pin_mut ! ( fast ) ; futures_util :: pin_mut ! ( slow ) ; let res = futures_util :: select ! { slow false fast true } ; assert ! ( res ) ; } ) . expect ( " " ) ; handle . await ; }
Verify timers work by making sure a shorter timer ends before the longer one.
Verify timers work by making sure a shorter timer ends before the longer one .
exec
impl LocalSpawnHandle<()> + Clone + Timer + 'static
exec
impl LocalSpawnHandle<()> + Clone + Timer + 'static