PredictorConfig

Trait PredictorConfig 

Source
pub trait PredictorConfig {
    // Required methods
    fn model_name(&self) -> &str;
    fn batch_size(&self) -> usize;
    fn validate(&self) -> OcrResult<()>;

    // Provided methods
    fn validate_batch_size(&self) -> OcrResult<()> { ... }
    fn validate_model_name(&self) -> OcrResult<()> { ... }
}
Expand description

Trait for predictor configurations.

This trait defines the interface for predictor configurations.

Required Methods§

Source

fn model_name(&self) -> &str

Gets the name of the model.

§Returns

The name of the model.

Source

fn batch_size(&self) -> usize

Gets the batch size.

§Returns

The batch size.

Source

fn validate(&self) -> OcrResult<()>

Validates the configuration.

§Returns

A Result indicating success or an error.

Provided Methods§

Source

fn validate_batch_size(&self) -> OcrResult<()>

Validates the batch size.

§Returns

A Result indicating success or an error.

§Validation Rules
  • Batch size must be greater than 0.
  • Batch size should not exceed 1000 for memory efficiency.
Source

fn validate_model_name(&self) -> OcrResult<()>

Validates the model name.

§Returns

A Result indicating success or an error.

§Validation Rules
  • Model name cannot be empty.

Implementors§