PredictorBuilder

Trait PredictorBuilder 

Source
pub trait PredictorBuilder: Sized {
    type Config;
    type Predictor;

    // Required methods
    fn build_typed(self, model_path: &Path) -> OcrResult<Self::Predictor>;
    fn predictor_type(&self) -> &str;
    fn with_config(self, config: Self::Config) -> Self;

    // Provided method
    fn build(self, model_path: &Path) -> OcrResult<Self::Predictor> { ... }
}
Expand description

Trait for building predictors.

This trait defines the interface for building predictors with specific configurations.

Required Associated Types§

Source

type Config

The configuration type for this builder.

Source

type Predictor

The predictor type that this builder creates.

Required Methods§

Source

fn build_typed(self, model_path: &Path) -> OcrResult<Self::Predictor>

Builds a typed predictor.

§Arguments
  • model_path - The path to the model file.
§Returns

A Result containing the built predictor or an error.

Source

fn predictor_type(&self) -> &str

Gets the type of predictor that this builder creates.

§Returns

The predictor type as a string.

Source

fn with_config(self, config: Self::Config) -> Self

Configures the builder with the given configuration.

§Arguments
  • config - The configuration to use.
§Returns

The configured builder.

Provided Methods§

Source

fn build(self, model_path: &Path) -> OcrResult<Self::Predictor>

Builds a predictor (alias for build_typed).

§Arguments
  • model_path - The path to the model file.
§Returns

A Result containing the built predictor or an error.

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§