pub struct MutateRun { /* private fields */ }Expand description
Configuration for a mutation testing run.
§Example
use dev_mutate::MutateRun;
use std::time::Duration;
let run = MutateRun::new("my-crate", "0.1.0")
.workspace()
.jobs(4)
.timeout(Duration::from_secs(120))
.exclude_re(r"^src/generated/");
let _result = run.execute().unwrap();Implementations§
Source§impl MutateRun
impl MutateRun
Sourcepub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
Begin a new mutation testing run.
name and version are descriptive — they identify the
subject in the produced Report.
Sourcepub fn in_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn in_dir(self, dir: impl Into<PathBuf>) -> Self
Run cargo mutants from dir instead of the current directory.
Sourcepub fn jobs(self, n: u32) -> Self
pub fn jobs(self, n: u32) -> Self
Pass --jobs <N> (parallel mutation runs). Maps to cargo-mutants’
own job limit.
Sourcepub fn timeout(self, d: Duration) -> Self
pub fn timeout(self, d: Duration) -> Self
Per-mutant timeout (passed through as --timeout <secs>).
Sourcepub fn exclude_re(self, pattern: impl Into<String>) -> Self
pub fn exclude_re(self, pattern: impl Into<String>) -> Self
Skip files matching the given regex. Repeatable; maps to
--exclude-re <pattern> per invocation.
Sourcepub fn file(self, pattern: impl Into<String>) -> Self
pub fn file(self, pattern: impl Into<String>) -> Self
Restrict to files matching the given glob / path. Repeatable;
maps to --file <pattern> per invocation.
Sourcepub fn allow(self, description: impl Into<String>) -> Self
pub fn allow(self, description: impl Into<String>) -> Self
Suppress a known-survivor by descriptor. The match is on the
description field of SurvivingMutant (e.g. "replace + with -").
Sourcepub fn subject_version(&self) -> &str
pub fn subject_version(&self) -> &str
Subject version passed in via new.
Sourcepub fn execute(&self) -> Result<MutateResult, MutateError>
pub fn execute(&self) -> Result<MutateResult, MutateError>
Execute the run.
Spawns cargo mutants --json with the configured flags. Tool
absence, subprocess failure, and parse failure surface as
typed MutateError variants. No panics.