pub struct FileCoverage {
pub all: bool,
pub path: String,
pub statement_map: IndexMap<u32, Range>,
pub fn_map: IndexMap<u32, Function>,
pub branch_map: IndexMap<u32, Branch>,
pub s: IndexMap<u32, u32>,
pub f: IndexMap<u32, u32>,
pub b: IndexMap<u32, Vec<u32>>,
pub b_t: Option<IndexMap<u32, Vec<u32>>>,
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: IndexMap<u32, Range>
§fn_map: IndexMap<u32, Function>
§branch_map: IndexMap<u32, Branch>
§s: IndexMap<u32, u32>
§f: IndexMap<u32, u32>
§b: IndexMap<u32, Vec<u32>>
§b_t: Option<IndexMap<u32, Vec<u32>>>
§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) -> IndexMap<u32, u32>
pub fn get_line_coverage(&self) -> IndexMap<u32, u32>
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) -> IndexMap<u32, Coverage>
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 moreSource§impl Debug for FileCoverage
impl Debug for FileCoverage
Source§impl<'de> Deserialize<'de> for FileCoverage
impl<'de> Deserialize<'de> for FileCoverage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FileCoverage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FileCoverage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FileCoverage
impl PartialEq for FileCoverage
Source§impl Serialize for FileCoverage
impl Serialize for FileCoverage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for FileCoverage
Auto Trait Implementations§
impl Freeze for FileCoverage
impl RefUnwindSafe for FileCoverage
impl Send for FileCoverage
impl Sync for FileCoverage
impl Unpin for FileCoverage
impl UnwindSafe for FileCoverage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ImplicitClone for Twhere
T: Clone,
impl<T> ImplicitClone for Twhere
T: Clone,
fn clone_quote_var(&self) -> Self
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more