mod pending_once;
pub use self::pending_once::PendingOnce;
use futures_core::future::Future;
use std::thread;
pub use crate::assert_unmoved::AssertUnmoved;
pub use crate::interleave_pending::InterleavePending;
pub trait FutureTestExt: Future {
fn assert_unmoved(self) -> AssertUnmoved<Self>
where
Self: Sized,
{
AssertUnmoved::new(self)
}
fn pending_once(self) -> PendingOnce<Self>
where
Self: Sized,
{
PendingOnce::new(self)
}
fn run_in_background(self)
where
Self: Sized + Send + 'static,
Self::Output: Send,
{
thread::spawn(|| futures_executor::block_on(self));
}
fn interleave_pending(self) -> InterleavePending<Self>
where
Self: Sized,
{
InterleavePending::new(self)
}
}
impl<Fut> FutureTestExt for Fut where Fut: Future {}