pub struct CoverageResult {
pub name: String,
pub version: String,
pub line_pct: f64,
pub function_pct: f64,
pub region_pct: f64,
pub total_lines: u64,
pub covered_lines: u64,
}Expand description
Result of a coverage run.
Fields§
§name: StringCrate name.
version: StringCrate version.
line_pct: f64Percentage of executable lines that were exercised by tests.
function_pct: f64Percentage of functions that were called by tests.
region_pct: f64Percentage of regions (branch points) that were exercised.
total_lines: u64Total executable lines in the crate.
covered_lines: u64Lines that were exercised at least once.
Implementations§
Source§impl CoverageResult
impl CoverageResult
Sourcepub fn into_check_result(self, threshold: CoverageThreshold) -> CheckResult
pub fn into_check_result(self, threshold: CoverageThreshold) -> CheckResult
Convert this result into a CheckResult against the given threshold.
Examples found in repository?
examples/basic.rs (line 16)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let run = CoverageRun::new("example", "0.1.0");
9 let result = run.execute()?;
10
11 println!("Line coverage: {:.2}%", result.line_pct);
12 println!("Function coverage: {:.2}%", result.function_pct);
13 println!("Region coverage: {:.2}%", result.region_pct);
14
15 let threshold = CoverageThreshold::min_line_pct(80.0);
16 let check = result.into_check_result(threshold);
17 println!("\nVerdict: {:?}", check.verdict);
18 if let Some(d) = check.detail {
19 println!("Detail: {d}");
20 }
21 Ok(())
22}Trait Implementations§
Source§impl Clone for CoverageResult
impl Clone for CoverageResult
Source§fn clone(&self) -> CoverageResult
fn clone(&self) -> CoverageResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CoverageResult
impl RefUnwindSafe for CoverageResult
impl Send for CoverageResult
impl Sync for CoverageResult
impl Unpin for CoverageResult
impl UnsafeUnpin for CoverageResult
impl UnwindSafe for CoverageResult
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