pub struct CheckResult {
pub name: String,
pub verdict: Verdict,
pub severity: Option<Severity>,
pub detail: Option<String>,
pub at: DateTime<Utc>,
pub duration_ms: Option<u64>,
pub tags: Vec<String>,
pub evidence: Vec<Evidence>,
}Expand description
Result of a single check.
§Example
use dev_report::{CheckResult, Severity, Verdict};
let c = CheckResult::fail("unit::math", Severity::Error)
.with_detail("expected 42, got 41")
.with_duration_ms(7);
assert_eq!(c.verdict, Verdict::Fail);Fields§
§name: StringStable identifier for the check (e.g. compile, test::round_trip).
verdict: VerdictOutcome of the check.
severity: Option<Severity>Severity when the verdict is Fail or Warn. None for Pass and Skip.
detail: Option<String>Human-readable detail. Optional.
at: DateTime<Utc>Time the check ran. UTC.
duration_ms: Option<u64>Duration of the check, in milliseconds. Optional.
Free-form tags for filtering (e.g. "slow", "flaky", "bench").
Defaults to empty. v0.1.0 reports deserialize cleanly with no tags.
evidence: Vec<Evidence>Structured evidence backing this check.
Defaults to empty. v0.1.0 reports deserialize cleanly with no evidence.
Implementations§
Source§impl CheckResult
impl CheckResult
Sourcepub fn pass(name: impl Into<String>) -> Self
pub fn pass(name: impl Into<String>) -> Self
Build a passing check result with the given name.
§Example
use dev_report::{CheckResult, Verdict};
let c = CheckResult::pass("compile");
assert_eq!(c.verdict, Verdict::Pass);
assert!(c.severity.is_none());Sourcepub fn fail(name: impl Into<String>, severity: Severity) -> Self
pub fn fail(name: impl Into<String>, severity: Severity) -> Self
Build a failing check result with the given name and severity.
§Example
use dev_report::{CheckResult, Severity, Verdict};
let c = CheckResult::fail("test::round_trip", Severity::Error);
assert_eq!(c.verdict, Verdict::Fail);
assert_eq!(c.severity, Some(Severity::Error));Sourcepub fn warn(name: impl Into<String>, severity: Severity) -> Self
pub fn warn(name: impl Into<String>, severity: Severity) -> Self
Build a warning check result with the given name and severity.
§Example
use dev_report::{CheckResult, Severity, Verdict};
let c = CheckResult::warn("flaky", Severity::Warning);
assert_eq!(c.verdict, Verdict::Warn);Sourcepub fn skip(name: impl Into<String>) -> Self
pub fn skip(name: impl Into<String>) -> Self
Build a skipped check result with the given name.
§Example
use dev_report::{CheckResult, Verdict};
let c = CheckResult::skip("not_applicable");
assert_eq!(c.verdict, Verdict::Skip);Sourcepub fn with_detail(self, detail: impl Into<String>) -> Self
pub fn with_detail(self, detail: impl Into<String>) -> Self
Attach a human-readable detail to this check result.
§Example
use dev_report::CheckResult;
let c = CheckResult::pass("a").with_detail("ran in single thread");
assert_eq!(c.detail.as_deref(), Some("ran in single thread"));Sourcepub fn with_duration_ms(self, ms: u64) -> Self
pub fn with_duration_ms(self, ms: u64) -> Self
Attach a duration measurement (milliseconds) to this check result.
§Example
use dev_report::CheckResult;
let c = CheckResult::pass("a").with_duration_ms(42);
assert_eq!(c.duration_ms, Some(42));Sourcepub fn with_severity(self, severity: Severity) -> Self
pub fn with_severity(self, severity: Severity) -> Self
Override the severity of this check result.
Useful when escalating or de-escalating a check after construction
(e.g. promote a Warn+Warning to Warn+Error based on a config flag).
§Example
use dev_report::{CheckResult, Severity};
let c = CheckResult::warn("flaky", Severity::Warning)
.with_severity(Severity::Error);
assert_eq!(c.severity, Some(Severity::Error));Sourcepub fn with_tag(self, tag: impl Into<String>) -> Self
pub fn with_tag(self, tag: impl Into<String>) -> Self
Attach a single tag to this check result.
§Example
use dev_report::CheckResult;
let c = CheckResult::pass("compile").with_tag("slow");
assert!(c.has_tag("slow"));Attach many tags at once from any iterable of strings.
§Example
use dev_report::CheckResult;
let c = CheckResult::pass("compile").with_tags(["slow", "flaky"]);
assert!(c.has_tag("flaky"));Sourcepub fn has_tag(&self, tag: &str) -> bool
pub fn has_tag(&self, tag: &str) -> bool
Return true if this check has the given tag.
§Example
use dev_report::CheckResult;
let c = CheckResult::pass("compile").with_tag("slow");
assert!(c.has_tag("slow"));
assert!(!c.has_tag("flaky"));Sourcepub fn with_evidence(self, e: Evidence) -> Self
pub fn with_evidence(self, e: Evidence) -> Self
Sourcepub fn with_evidences<I>(self, items: I) -> Selfwhere
I: IntoIterator<Item = Evidence>,
pub fn with_evidences<I>(self, items: I) -> Selfwhere
I: IntoIterator<Item = Evidence>,
Trait Implementations§
Source§impl Clone for CheckResult
impl Clone for CheckResult
Source§fn clone(&self) -> CheckResult
fn clone(&self) -> CheckResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more