Struct swc_coverage_instrument::FileCoverage
source · [−]pub struct FileCoverage {
pub all: bool,
pub path: String,
pub statement_map: IndexMap<u32, Range, RandomState>,
pub fn_map: IndexMap<u32, Function, RandomState>,
pub branch_map: IndexMap<u32, Branch, RandomState>,
pub s: IndexMap<u32, u32, RandomState>,
pub f: IndexMap<u32, u32, RandomState>,
pub b: IndexMap<u32, Vec<u32, Global>, RandomState>,
pub b_t: Option<IndexMap<u32, Vec<u32, Global>, RandomState>>,
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: boolpath: Stringstatement_map: IndexMap<u32, Range, RandomState>fn_map: IndexMap<u32, Function, RandomState>branch_map: IndexMap<u32, Branch, RandomState>s: IndexMap<u32, u32, RandomState>f: IndexMap<u32, u32, RandomState>b: IndexMap<u32, Vec<u32, Global>, RandomState>b_t: Option<IndexMap<u32, Vec<u32, Global>, RandomState>>input_source_map: Option<SourceMap>Implementations
sourceimpl 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, RandomState>
pub fn get_line_coverage(&self) -> IndexMap<u32, u32, RandomState>
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, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_uncovered_lines(&self) -> Vec<u32, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns an array of uncovered line numbers.
pub fn get_branch_coverage_by_line(
&self
) -> IndexMap<u32, Coverage, RandomState>
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, RandomState>
) -> Totals
pub fn reset_hits(&mut self)
pub fn to_summary(&self) -> CoverageSummary
Trait Implementations
sourceimpl Clone for FileCoverage
impl Clone for FileCoverage
sourcefn clone(&self) -> FileCoverage
fn clone(&self) -> FileCoverage
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for FileCoverage
impl Debug for FileCoverage
sourceimpl<'de> Deserialize<'de> for FileCoverage
impl<'de> Deserialize<'de> for FileCoverage
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<FileCoverage> for FileCoverage
impl PartialEq<FileCoverage> for FileCoverage
sourcefn eq(&self, other: &FileCoverage) -> bool
fn eq(&self, other: &FileCoverage) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &FileCoverage) -> bool
fn ne(&self, other: &FileCoverage) -> bool
This method tests for !=.
sourceimpl Serialize for FileCoverage
impl Serialize for FileCoverage
sourcefn 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,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for FileCoverage
Auto Trait Implementations
impl RefUnwindSafe for FileCoverage
impl Send for FileCoverage
impl Sync for FileCoverage
impl Unpin for FileCoverage
impl UnwindSafe for FileCoverage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more