async fn run_with_harness<H, F, Fut>(test_func: F) -> Result<(), Error>
where
    H: TestHarness,
    F: FnOnce(H) -> Fut + Send + 'static,
    Fut: Future<Output = Result<(), Error>> + Send + 'static,
{
    let (harness, env, runner) = H::init().await?;

    let run_test = test_func(harness);
    pin_mut!(run_test);
    pin_mut!(runner);

    let result = select! {
        test_result = run_test.fuse() => test_result,
        runner_result = runner.fuse() => runner_result,
    };

    let term_result = H::terminate(env).await;
    // Return test failure if it exists, else return terminate failure, else return the
    // successful test result
    result.and_then(|ok| term_result.map(|_| ok))
}
/// We can run any test which is an async function from some harness `H` to a result
We can run any test which is an async function from some harness `H` to a result
We can run any test which is an async function from some harness ` H ` to a result
async fn run_with_harness<H, F, Fut>(test_func: F) -> Result<(), Error>
where
    H: TestHarness,
    F: FnOnce(H) -> Fut + Send + 'static,
    Fut: Future<Output = Result<(), Error>> + Send + 'static,
{
    let (harness, env, runner) = H::init().await?;
    let run_test = test_func(harness);
    pin_mut!(run_test);
    pin_mut!(runner);
    let result = select! {
        test_result = run_test.fuse() => test_result,
        runner_result = runner.fuse() => runner_result,
    };
    let term_result = H::terminate(env).await;
    // Return test failure if it exists, else return terminate failure, else return the
    // successful test result
    result.and_then(|ok| term_result.map(|_| ok))
}
async fn run_with_harness < H , F , Fut > ( test_func : F ) -> Result < ( ) , Error > where H : TestHarness , F : FnOnce ( H ) -> Fut + Send + ' static , Fut : Future < Output = Result < ( ) , Error > > + Send + ' static , { let ( harness , env , runner ) = H :: init ( ) . await ? ; let run_test = test_func ( harness ) ; pin_mut ! ( run_test ) ; pin_mut ! ( runner ) ; let result = select ! { test_result run_test fuse ( ) test_result runner_result runner fuse ( ) runner_result } ; let term_result = H :: terminate ( env ) . await ; // Return test failure if it exists, else return terminate failure, else return the // successful test result result . and_then ( | ok | term_result . map ( | _ | ok ) ) }
We can run any test which is an async function from some harness `H` to a result
We can run any test which is an async function from some harness ` H ` to a result
test_func
F