refactor(rust-ocr): drop Value-based provider trait; dispatch by match

This commit is contained in:
Ishaan Jaffer 2026-06-23 14:16:19 -07:00
parent e8eca699c9
commit f16f3386cc
No known key found for this signature in database
2 changed files with 0 additions and 33 deletions

View file

@ -1,2 +1 @@
pub mod transformation;
pub mod types;

View file

@ -1,32 +0,0 @@
use serde_json::{Map, Value};
use crate::CoreResult;
use super::types::{OcrRequestData, OcrResponseData};
pub trait OcrProviderConfig {
fn supported_ocr_params(&self) -> &'static [&'static str];
fn map_ocr_params(&self, non_default_params: &Map<String, Value>) -> Map<String, Value> {
let mut mapped_params = Map::new();
for (param, value) in non_default_params {
if self.supported_ocr_params().contains(&param.as_str()) {
mapped_params.insert(param.clone(), value.clone());
}
}
mapped_params
}
fn transform_ocr_request(
&self,
model: &str,
document: Value,
optional_params: Map<String, Value>,
) -> CoreResult<OcrRequestData>;
fn transform_ocr_response(
&self,
model: &str,
response_json: Value,
) -> CoreResult<OcrResponseData>;
}