pub trait AsyncCheck {
type Output;
type Fut: Future<Output = Self::Output>;
// Required method
fn run(self) -> Self::Fut;
}Expand description
A trait for any async harness that produces a verdict via a future.
dev-report::Producer is synchronous, which doesn’t fit async
harnesses. AsyncCheck is the async equivalent.
§Example
use dev_async::AsyncCheck;
use dev_report::CheckResult;
use std::future::Future;
use std::pin::Pin;
struct PingCheck;
impl AsyncCheck for PingCheck {
type Output = CheckResult;
type Fut = Pin<Box<dyn Future<Output = CheckResult> + Send>>;
fn run(self) -> Self::Fut {
Box::pin(async move { CheckResult::pass("ping") })
}
}