pub struct AnalysisContext<'r> { /* private fields */ }Expand description
An analysis context, which is used to perform analysis on a difftest, or a test index.
To get a context, you can use the
HasExportedProfdata::start_analysis,
AnalysisContext::from_index, AnalysisContext::with_index_from,
or AnalysisContext::with_index_from_difftest associated functions.
Implementations§
Source§impl AnalysisContext<'static>
impl AnalysisContext<'static>
Sourcepub fn from_index(index: TestIndex) -> Self
pub fn from_index(index: TestIndex) -> Self
Create a new context from a test index.
Sourcepub fn with_index_from(p: &Path) -> DifftestsResult<Self>
pub fn with_index_from(p: &Path) -> DifftestsResult<Self>
Create a new context from a test index, read from the file at the given path.
Sourcepub fn with_index_from_difftest(difftest: &Difftest) -> DifftestsResult<Self>
pub fn with_index_from_difftest(difftest: &Difftest) -> DifftestsResult<Self>
Create a new context from a test index, read from the index from the Difftest.
Source§impl<'r> AnalysisContext<'r>
impl<'r> AnalysisContext<'r>
Sourcepub fn get_profdata(&self) -> Option<&CoverageData>
pub fn get_profdata(&self) -> Option<&CoverageData>
Get the optional CoverageData that is used for analysis.
Sourcepub fn get_difftest(&self) -> Option<&Difftest>
pub fn get_difftest(&self) -> Option<&Difftest>
Get the optional Difftest that is used for analysis.
Sourcepub fn get_index(&self) -> Option<&TestIndex>
pub fn get_index(&self) -> Option<&TestIndex>
Get the optional TestIndex that is used for analysis.
Sourcepub fn finish_analysis(self) -> AnalysisResult
pub fn finish_analysis(self) -> AnalysisResult
Finish the analysis, and return the result.
This function should be called after AnalysisContext::run.
Sourcepub fn test_run_at(&self) -> DifftestsResult<SystemTime>
pub fn test_run_at(&self) -> DifftestsResult<SystemTime>
Gets the time at which the test was run.
Sourcepub fn regions(&self) -> AnalysisRegions<'_> ⓘ
pub fn regions(&self) -> AnalysisRegions<'_> ⓘ
Gets an iterator over the regions that are covered by the test.
This iterator does not filter the regions that were not touched, so it
may contain regions that were not covered by the test, but still were there
in the CoverageData.
If using a TestIndex to run the analysis, then this iterator will only
contain the regions that were touched by the test, as those are the only
regions present in the TestIndex.
To clarify, we call the regions that had a non-zero execution count “touched”.
pub fn files(&self, include_registry_files: bool) -> BTreeSet<PathBuf>
Source§impl<'r> AnalysisContext<'r>
impl<'r> AnalysisContext<'r>
Sourcepub fn run(&mut self, config: &AnalysisConfig) -> DifftestsResult
pub fn run(&mut self, config: &AnalysisConfig) -> DifftestsResult
Runs the analysis, with the given AnalysisConfig.
This should only be called once.
If called multiple times, the output of
the analysis will correspond to the last AnalysisContext::run call.