pub trait MutablePluginModel<Mutate, Context, Output>: Default {
// Required method
fn compute_mut(&self, input: &mut Mutate, context: &Context) -> Output;
}Expand description
Trait implemented by mutable plugin models that may transform their input in-place while still producing an output.
Unlike PurePluginModel, this trait explicitly allows mutation of the input,
making it suitable for in-place normalization, sorting, accumulation,
or other performance-sensitive transformations that avoid extra allocations.
Mutation is explicit and opt-in, preserving clarity between pure and state-transforming computations.
§Generics
Mutate: Type of data that will be mutated in-place.Context: External parameters or configuration required by the model.Output: Type of value produced by the model.
§Semantics
- The input may be modified during computation.
- The returned output may be derived from either the original or mutated state.
- Implementations should still remain stateless with respect to internal storage.
Required Methods§
Sourcefn compute_mut(&self, input: &mut Mutate, context: &Context) -> Output
fn compute_mut(&self, input: &mut Mutate, context: &Context) -> Output
Computes the model’s output while mutating the input in-place.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.