pub struct CoverageRun { /* private fields */ }Expand description
Configuration for a coverage run.
Implementations§
Source§impl CoverageRun
impl CoverageRun
Sourcepub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
Begin a coverage run for the given crate name and version.
Examples found in repository?
examples/basic.rs (line 8)
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}Sourcepub fn execute(&self) -> Result<CoverageResult, CoverageError>
pub fn execute(&self) -> Result<CoverageResult, CoverageError>
Execute the coverage run.
In 0.9.0 this is a stub; the actual cargo llvm-cov
invocation lands in 0.9.1.
Examples found in repository?
examples/basic.rs (line 9)
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 CoverageRun
impl Clone for CoverageRun
Source§fn clone(&self) -> CoverageRun
fn clone(&self) -> CoverageRun
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 CoverageRun
impl RefUnwindSafe for CoverageRun
impl Send for CoverageRun
impl Sync for CoverageRun
impl Unpin for CoverageRun
impl UnsafeUnpin for CoverageRun
impl UnwindSafe for CoverageRun
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