Skip to main content

Producer

Trait Producer 

Source
pub trait Producer {
    // Required method
    fn produce(&self) -> Report;
}
Expand description

A producer of reports. Implement this on your harness type to integrate with the dev-* suite.

§Example

use dev_report::{CheckResult, Producer, Report};

struct CompileChecker;
impl Producer for CompileChecker {
    fn produce(&self) -> Report {
        let mut r = Report::new("my-crate", "0.1.0").with_producer("compile-checker");
        r.push(CheckResult::pass("compile"));
        r.finish();
        r
    }
}

let r = CompileChecker.produce();
assert_eq!(r.checks.len(), 1);

Required Methods§

Source

fn produce(&self) -> Report

Run the producer and return a finalized report.

Implementations SHOULD encode setup failures as Fail checks inside the returned Report rather than panicking.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§