Skip to main content

MutateDispatch

Trait MutateDispatch 

Source
pub trait MutateDispatch: Sized {
    // Required method
    fn dispatch_mutate(
        &mut self,
        value: &StructuralView,
        mutator: &mut Mutator,
    ) -> Option<Result<Any>>;

    // Provided method
    fn dispatch_mutate_value(
        &mut self,
        value: MutateValue<'_>,
        mutator: &mut Mutator,
    ) -> Option<Result<Any>> { ... }
}
Expand description

Ordered typed callback dispatch for structural_mutate.

None means no handler matched, so structural mutation applies its default behavior. A generated #[dispatch(mutate)] implementation tests mutate_* methods in source order and passes the same Mutator to the first match. The implementation owns its pass state and receives &mut self, while Mutator controls recursion, the definition region, and in-place permission. Handlers can consume MutateValue and take an optional &mut Mutator to inspect the region and in-place permission.

Required Methods§

Source

fn dispatch_mutate( &mut self, value: &StructuralView, mutator: &mut Mutator, ) -> Option<Result<Any>>

Provided Methods§

Source

fn dispatch_mutate_value( &mut self, value: MutateValue<'_>, mutator: &mut Mutator, ) -> Option<Result<Any>>

Dispatch an engine-issued value. Existing borrowed dispatchers retain their copy-only default recursion; generated dispatch supports consuming it.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§