pub struct DiagnosticReport {
pub checks: Vec<CheckResult>,
pub passed_count: usize,
pub failed_count: usize,
}Expand description
Aggregate result from running all detection checks.
§Example
use stygian_browser::diagnostic::{all_checks, DiagnosticReport};
let results = all_checks()
.iter()
.map(|c| c.parse_output(r#"{"passed":true,"details":"ok"}"#))
.collect::<Vec<_>>();
let report = DiagnosticReport::new(results);
assert!(report.is_clean());
assert!((report.coverage_pct() - 100.0).abs() < 0.001);Fields§
§checks: Vec<CheckResult>Individual check results in catalogue order.
passed_count: usizeNumber of checks where passed == true.
failed_count: usizeNumber of checks where passed == false.
Implementations§
Source§impl DiagnosticReport
impl DiagnosticReport
Sourcepub fn new(checks: Vec<CheckResult>) -> Self
pub fn new(checks: Vec<CheckResult>) -> Self
Build a report from an ordered list of check results.
Sourcepub fn coverage_pct(&self) -> f64
pub fn coverage_pct(&self) -> f64
Percentage of checks that passed (0.0–100.0).
Sourcepub fn failures(&self) -> impl Iterator<Item = &CheckResult>
pub fn failures(&self) -> impl Iterator<Item = &CheckResult>
Iterate over all checks that returned passed: false.
Trait Implementations§
Source§impl Clone for DiagnosticReport
impl Clone for DiagnosticReport
Source§fn clone(&self) -> DiagnosticReport
fn clone(&self) -> DiagnosticReport
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DiagnosticReport
impl Debug for DiagnosticReport
Source§impl<'de> Deserialize<'de> for DiagnosticReport
impl<'de> Deserialize<'de> for DiagnosticReport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DiagnosticReport
impl RefUnwindSafe for DiagnosticReport
impl Send for DiagnosticReport
impl Sync for DiagnosticReport
impl Unpin for DiagnosticReport
impl UnsafeUnpin for DiagnosticReport
impl UnwindSafe for DiagnosticReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more