Get editor tests compiling

This commit is contained in:
Mikayla
2023-11-13 12:10:14 -08:00
parent 4c5d5105f3
commit 0e3fd92bd0
8 changed files with 1618 additions and 1426 deletions
+15 -11
View File
@@ -1,16 +1,20 @@
use std::time::Duration;
use futures::Future;
use smol::future::FutureExt;
pub use util::*;
// pub async fn timeout<F, T>(timeout: Duration, f: F) -> Result<T, ()>
// where
// F: Future<Output = T>,
// {
// let timer = async {
// smol::Timer::after(timeout).await;
// Err(())
// };
// let future = async move { Ok(f.await) };
// timer.race(future).await
// }
pub async fn timeout<F, T>(timeout: Duration, f: F) -> Result<T, ()>
where
F: Future<Output = T>,
{
let timer = async {
smol::Timer::after(timeout).await;
Err(())
};
let future = async move { Ok(f.await) };
timer.race(future).await
}
#[cfg(any(test, feature = "test-support"))]
pub struct CwdBacktrace<'a>(pub &'a backtrace::Backtrace);