pub struct FileCoverage {
pub all: bool,
pub path: String,
pub statement_map: StatementMap,
pub fn_map: FunctionMap,
pub branch_map: BranchMap,
pub s: LineHitMap,
pub f: LineHitMap,
pub b: BranchHitMap,
pub b_t: Option<BranchHitMap>,
pub input_source_map: Option<SourceMap>,
}Expand description
provides a read-only view of coverage for a single file.
It has the following properties:
path - the file path for which coverage is being tracked
statementMap - map of statement locations keyed by statement index
fnMap - map of function metadata keyed by function index
branchMap - map of branch metadata keyed by branch index
s - hit counts for statements
f - hit count for functions
b - hit count for branches
Note: internally it uses IndexMap to represent key-value pairs for the coverage data, as logic for merge relies on the order of keys in the map.
Fields§
§all: bool§path: String§statement_map: StatementMap§fn_map: FunctionMap§branch_map: BranchMap§s: LineHitMap§f: LineHitMap§b: BranchHitMap§b_t: Option<BranchHitMap>§input_source_map: Option<SourceMap>Implementations§
Source§impl FileCoverage
impl FileCoverage
pub fn empty(file_path: String, report_logic: bool) -> FileCoverage
pub fn from_file_path(file_path: String, report_logic: bool) -> FileCoverage
pub fn from_file_coverage(coverage: &FileCoverage) -> FileCoverage
Sourcepub fn get_line_coverage(&self) -> LineHitMap
pub fn get_line_coverage(&self) -> LineHitMap
Returns computed line coverage from statement coverage. This is a map of hits keyed by line number in the source.
Sourcepub fn get_uncovered_lines(&self) -> Vec<u32>
pub fn get_uncovered_lines(&self) -> Vec<u32>
Returns an array of uncovered line numbers.
pub fn get_branch_coverage_by_line(&self) -> BranchCoverageMap
pub fn to_json()
Sourcepub fn merge(&mut self, coverage: &FileCoverage)
pub fn merge(&mut self, coverage: &FileCoverage)
Merges a second coverage object into this one, updating hit counts
pub fn compute_simple_totals<T>(line_map: &IndexMap<T, u32>) -> Totals
pub fn reset_hits(&mut self)
pub fn to_summary(&self) -> CoverageSummary
Trait Implementations§
Source§impl Clone for FileCoverage
impl Clone for FileCoverage
Source§fn clone(&self) -> FileCoverage
fn clone(&self) -> FileCoverage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more