use
{
crate :: { import::* } ,
std :: { future::Future } ,
};
#[ derive( Copy, Clone, Default ) ]
#[ cfg_attr( nightly, doc(cfg( feature = "async_std" )) ) ]
pub struct AsyncStd;
impl AsyncStd
{
pub fn new() -> Self
{
Self::default()
}
pub fn block_on<F: Future>(future: F) -> F::Output
{
async_std_crate::task::block_on( future )
}
}
impl Spawn for AsyncStd
{
fn spawn_obj( &self, future: FutureObj<'static, ()> ) -> Result<(), FutSpawnErr>
{
async_std_crate::task::spawn( future );
Ok(())
}
}
impl std::fmt::Debug for AsyncStd
{
fn fmt( &self, f: &mut std::fmt::Formatter<'_> ) -> std::fmt::Result
{
write!( f, "AsyncStd threadpool" )
}
}