pub trait Builder<M, Input, Output>where
M: BaseModel<Input, Output>,{
// Required method
fn build(&self) -> Result<M, ModelError>;
}Expand description
A trait for implementing the Builder pattern for machine learning models.
This trait ensures that any builder can construct a specific model type through a consistent interface. Builders allow for flexible configuration of model parameters before instantiation.
Required Methods§
Sourcefn build(&self) -> Result<M, ModelError>
fn build(&self) -> Result<M, ModelError>
Builds and returns a new model instance with the configured parameters.
§Returns
Result<M, ModelError>- The constructed model if successful, or an error if the construction fails (e.g., due to invalid configuration parameters)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".