pub trait Mutation: Send + Sync {
// Required methods
fn describe(&self) -> String;
fn mutation_type(&self) -> &'static str;
fn box_clone(&self) -> Box<dyn Mutation>;
// Provided methods
fn validate(&self, _file: &PureFile) -> ValidationResult { ... }
fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool { ... }
}Expand description
A mutation that can be applied to AST.
§Execution APIs
-
ASTRegApply::apply_to_registry()(V2, preferred): Registry-based execution viaASTMutationContext. Defined inryo-executorto avoid circular dependencies. -
apply()(Legacy, deprecated): File-based execution via&mut PureFile. Will be removed in future versions.
§Migration Guide
New mutations should implement ASTRegApply trait in ryo-executor::engine.
See ryo-executor::engine::impls for implementation examples.
Required Methods§
Sourcefn mutation_type(&self) -> &'static str
fn mutation_type(&self) -> &'static str
Get the mutation type name
Provided Methods§
Sourcefn validate(&self, _file: &PureFile) -> ValidationResult
fn validate(&self, _file: &PureFile) -> ValidationResult
Validate the mutation before applying
Returns validation issues that may indicate:
- Fatal errors (mutation will fail)
- Conflicts (may conflict with parallel mutations)
- Warnings (potential issues)
- Info (informational, no impact)
Default implementation returns no issues (always valid).
Sourcefn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
Check if this mutation can proceed with the given strategy
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".