Skip to main content

ASTRegApply

Trait ASTRegApply 

Source
pub trait ASTRegApply: Mutation {
    // Required method
    fn apply_to_registry(
        &self,
        ctx: &mut ASTMutationContext<'_>,
    ) -> MutationResult;
}
Expand description

Trait for mutations that can be applied to ASTRegistry

Extends the base Mutation trait with registry-based execution. This is the primary execution path for the new AST-centric architecture.

§Implementing

Mutations that want to support registry-based execution should:

  1. Implement this trait
  2. Use ctx.lookup() to find target symbols
  3. Use ctx.get_ast_mut() to modify AST
  4. Use ctx.emit_*() to record changes

§Fallback

If a mutation doesn’t implement this trait, ASTMutationEngine will return no changes. The legacy apply(&mut PureFile) path remains available for backward compatibility.

Required Methods§

Source

fn apply_to_registry(&self, ctx: &mut ASTMutationContext<'_>) -> MutationResult

Apply this mutation to the ASTRegistry

§Arguments
  • ctx - Mutable context providing access to registries and event emission
§Returns

MutationResult indicating the number of changes made

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ASTRegApply for AddConstMutation

Source§

impl ASTRegApply for AddTypeAliasMutation

Source§

impl ASTRegApply for RemoveConstMutation

Source§

impl ASTRegApply for RemoveTypeAliasMutation

Source§

impl ASTRegApply for CreateModMutation

Source§

impl ASTRegApply for AddDeriveMutation

Source§

impl ASTRegApply for RemoveDeriveMutation

Source§

impl ASTRegApply for AddEnumMutation

Source§

impl ASTRegApply for AddVariantMutation

Source§

impl ASTRegApply for RemoveEnumMutation

Source§

impl ASTRegApply for RemoveVariantMutation

Source§

impl ASTRegApply for AddFieldMutation

Source§

impl ASTRegApply for AddStructLiteralFieldMutation

Source§

impl ASTRegApply for RemoveFieldMutation

Source§

impl ASTRegApply for RemoveStructLiteralFieldMutation

Source§

impl ASTRegApply for AddFunctionMutation

Source§

impl ASTRegApply for RemoveFunctionMutation

Source§

impl ASTRegApply for AddImplMutation

Source§

impl ASTRegApply for RemoveImplMutation

Source§

impl ASTRegApply for AddItemMutation

Source§

impl ASTRegApply for AddPureItemsMutation

Source§

impl ASTRegApply for MoveItemMutation

Source§

impl ASTRegApply for RemoveItemMutation

Source§

impl ASTRegApply for AddMatchArmMutation

Source§

impl ASTRegApply for RemoveMatchArmMutation

Source§

impl ASTRegApply for ReplaceMatchArmMutation

Source§

impl ASTRegApply for AddMethodMutation

New design: Add method directly to Struct/Enum

Flow:

  1. Register method as Type::method in SymbolRegistry
  2. Store method AST in ASTRegistry
  3. Add/update plain impl block in parent module’s module_items
Source§

impl ASTRegApply for RemoveMethodMutation

New design: Remove method directly from Struct/Enum

Source§

impl ASTRegApply for RemoveModMutation

Source§

impl ASTRegApply for RenameMutation

Source§

impl ASTRegApply for InsertStatementMutation

Source§

impl ASTRegApply for RemoveStatementMutation

Source§

impl ASTRegApply for ReplaceExprMutation

Source§

impl ASTRegApply for ReplaceExprAtMutation

Source§

impl ASTRegApply for ReplaceStatementMutation

Source§

impl ASTRegApply for WrapExprMutation

Source§

impl ASTRegApply for AddStructMutation

Source§

impl ASTRegApply for RemoveStructMutation

Source§

impl ASTRegApply for EnumToTraitMutation

Source§

impl ASTRegApply for ExtractTraitMutation

Source§

impl ASTRegApply for InlineTraitMutation

Source§

impl ASTRegApply for RemoveTraitMutation

Source§

impl ASTRegApply for AddUseMutation

Source§

impl ASTRegApply for RemoveUseMutation

Source§

impl ASTRegApply for ChangeVisibilityMutation

Source§

impl ASTRegApply for DbgWrapMutation

Source§

impl ASTRegApply for InsertInspectMutation

Source§

impl ASTRegApply for RemoveDebugLogsMutation

Source§

impl ASTRegApply for AssignOpMutation

Source§

impl ASTRegApply for BoolSimplifyMutation

Source§

impl ASTRegApply for CloneOnCopyMutation

Source§

impl ASTRegApply for CollapsibleIfMutation

Source§

impl ASTRegApply for ComparisonToMethodMutation

Source§

impl ASTRegApply for DefaultMutation

Source§

impl ASTRegApply for DeriveDefaultMutation

Source§

impl ASTRegApply for FilterNextMutation

Source§

impl ASTRegApply for IntroduceVariableMutation

Source§

impl ASTRegApply for LockScopeMutation

Source§

impl ASTRegApply for UseAtomicMutation

Source§

impl ASTRegApply for UseRwLockMutation

Source§

impl ASTRegApply for LoopToIteratorMutation

Source§

impl ASTRegApply for ManualMapMutation

Source§

impl ASTRegApply for MapUnwrapOrMutation

Source§

impl ASTRegApply for MatchToIfLetMutation

Source§

impl ASTRegApply for NoOpArmToTodoMutation

Source§

impl ASTRegApply for OrganizeImportsMutation

Source§

impl ASTRegApply for RedundantClosureMutation

Source§

impl ASTRegApply for UnwrapToQuestionMutation

Implementors§