Trait PurePluginModel

Source
pub trait PurePluginModel<Input, Context, Output>: Default {
    // Required method
    fn compute(&self, input: Input, context: &Context) -> Output;
}
Expand description

Core trait implemented by all immutable plugin models.

A plugin model is typically a zero-sized (stateless) struct that defines a specific computation strategy. Each model represents a logically distinct variant within a plugin and may optionally depend on external context to compute its result.

This trait defines the pure computation contract: the input is owned by caller immutably and must not be mutated. The model returns a new output value derived from the input and context.

§Generics

  • Input: Type of owned-data consumed by the model.
  • Context: External parameters or configuration required by the model.
  • Output: Type of value produced by the model.

§Determinism

Implementations are expected to be stateless and deterministic, producing the same output for the same input and context.

Required Methods§

Source

fn compute(&self, input: Input, context: &Context) -> Output

Computes the model’s output for a given immutable input and context.

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.

Implementors§