Skip to main content

AsyncCheck

Trait AsyncCheck 

Source
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") })
    }
}

Required Associated Types§

Source

type Output

Output of the check. Typically CheckResult.

Source

type Fut: Future<Output = Self::Output>

The future returned by run.

Required Methods§

Source

fn run(self) -> Self::Fut

Run the check.

Implementors§