pub trait Run {
// Required methods
fn dry_run(
&self,
context: &LightContext<'_>,
source_file: &Path,
) -> Result<()>;
fn instrument_source_file(
&self,
context: &LightContext<'_>,
rewriter: &mut Rewriter<'_>,
source_file: &SourceFile,
n_instrumentable_statements: usize,
) -> Result<()>;
fn statement_prefix_and_suffix(
&self,
span: &Span,
) -> Result<(String, String)>;
fn build_source_file(
&self,
context: &LightContext<'_>,
source_file: &Path,
) -> Result<()>;
fn exec(
&self,
context: &LightContext<'_>,
test_name: &str,
span: &Span,
) -> Result<Result<(Exec, Option<Box<Postprocess>>)>>;
}Required Methods§
fn dry_run(&self, context: &LightContext<'_>, source_file: &Path) -> Result<()>
fn instrument_source_file( &self, context: &LightContext<'_>, rewriter: &mut Rewriter<'_>, source_file: &SourceFile, n_instrumentable_statements: usize, ) -> Result<()>
fn statement_prefix_and_suffix(&self, span: &Span) -> Result<(String, String)>
fn build_source_file( &self, context: &LightContext<'_>, source_file: &Path, ) -> Result<()>
Sourcefn exec(
&self,
context: &LightContext<'_>,
test_name: &str,
span: &Span,
) -> Result<Result<(Exec, Option<Box<Postprocess>>)>>
fn exec( &self, context: &LightContext<'_>, test_name: &str, span: &Span, ) -> Result<Result<(Exec, Option<Box<Postprocess>>)>>
Execute test test_name with span removed. Returns Ok(None) if the test could not be
built.
In most cases, just span.source_file is used. But in the implementation of RunLow::exec,
span is used for error reporting.
Result<Result<..>> is a questionable return type. The inner Result represents the result
of trying to build the project under test. Having it is useful for when the “Instrumentation
failed to build after it was verified to” assertion fails.