pub struct TraceMap { /* private fields */ }
Expand description
Stores all the program traces mapped to files and provides an interface to add, query and change traces.
Implementations§
Source§impl TraceMap
impl TraceMap
pub fn set_functions(&mut self, functions: HashMap<PathBuf, Vec<Function>>)
Sourcepub fn iter(&self) -> Iter<'_, PathBuf, Vec<Trace>>
pub fn iter(&self) -> Iter<'_, PathBuf, Vec<Trace>>
Provides an iterator to the underlying map of PathBufs to Vec
Sourcepub fn merge(&mut self, other: &TraceMap)
pub fn merge(&mut self, other: &TraceMap)
Merges the results of one tracemap into the current one. This adds records which are missing and adds the statistics gathered to existing records
Sourcepub fn dedup(&mut self)
pub fn dedup(&mut self)
This will collapse duplicate Traces into a single trace. Warning this will lose the addresses of the duplicate traces but increment the results should be called only if you don’t need those addresses from then on TODO possibly not the cleanest solution
Sourcepub fn add_trace(&mut self, file: &Path, trace: Trace)
pub fn add_trace(&mut self, file: &Path, trace: Trace)
Add a trace to the tracemap for the given file
pub fn add_file(&mut self, file: &Path)
Sourcepub fn get_trace(&self, address: u64) -> Option<&Trace>
pub fn get_trace(&self, address: u64) -> Option<&Trace>
Gets an immutable reference to a trace from an address. Returns None if there is no trace at that address
pub fn increment_hit(&mut self, address: u64)
pub fn get_location(&self, address: u64) -> Option<Location>
Sourcepub fn contains_location(&self, file: &Path, line: u64) -> bool
pub fn contains_location(&self, file: &Path, line: u64) -> bool
Returns true if the location described by file and line number is present in the tracemap
Sourcepub fn contains_file(&self, file: &Path) -> bool
pub fn contains_file(&self, file: &Path) -> bool
Returns true if the file is among the traces
Sourcepub fn get_child_traces<'a>(
&'a self,
root: &'a Path,
) -> impl Iterator<Item = &'a Trace> + 'a
pub fn get_child_traces<'a>( &'a self, root: &'a Path, ) -> impl Iterator<Item = &'a Trace> + 'a
Gets all traces below a certain path
pub fn get_functions(&self, file: &Path) -> impl Iterator<Item = &Function>
pub fn file_traces_mut(&mut self, file: &Path) -> Option<&mut Vec<Trace>>
Sourcepub fn all_traces(&self) -> impl Iterator<Item = &Trace>
pub fn all_traces(&self) -> impl Iterator<Item = &Trace>
Gets all traces
pub fn files(&self) -> Vec<&PathBuf>
pub fn coverable_in_path(&self, path: &Path) -> usize
pub fn covered_in_path(&self, path: &Path) -> usize
Sourcepub fn total_coverable(&self) -> usize
pub fn total_coverable(&self) -> usize
Give the total amount of coverable points in the code. This will vary based on the statistics available for line coverage it will be total lines whereas for condition or decision it will count the number of conditions available
Sourcepub fn total_covered(&self) -> usize
pub fn total_covered(&self) -> usize
From all the coverable data return the amount covered
Sourcepub fn coverage_percentage(&self) -> f64
pub fn coverage_percentage(&self) -> f64
Returns coverage percentage ranging from 0.0-1.0