Struct AnalysisContext

Source
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>

Source

pub fn from_index(index: TestIndex) -> Self

Create a new context from a test index.

Source

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.

Source

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>

Source

pub fn get_profdata(&self) -> Option<&CoverageData>

Get the optional CoverageData that is used for analysis.

Source

pub fn get_difftest(&self) -> Option<&Difftest>

Get the optional Difftest that is used for analysis.

Source

pub fn get_index(&self) -> Option<&TestIndex>

Get the optional TestIndex that is used for analysis.

Source

pub fn finish_analysis(self) -> AnalysisResult

Finish the analysis, and return the result.

This function should be called after AnalysisContext::run.

Source

pub fn test_run_at(&self) -> DifftestsResult<SystemTime>

Gets the time at which the test was run.

Source

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”.

Source

pub fn files(&self, include_registry_files: bool) -> BTreeSet<PathBuf>

Source§

impl<'r> AnalysisContext<'r>

Source

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.

Auto Trait Implementations§

§

impl<'r> Freeze for AnalysisContext<'r>

§

impl<'r> RefUnwindSafe for AnalysisContext<'r>

§

impl<'r> Send for AnalysisContext<'r>

§

impl<'r> Sync for AnalysisContext<'r>

§

impl<'r> Unpin for AnalysisContext<'r>

§

impl<'r> !UnwindSafe for AnalysisContext<'r>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T