use async_trait::async_trait;
use super::{OcrEngine, OcrError, OcrResult};
const STUB_LANGUAGES: [&str; 0] = [];
pub struct StubEngine;
#[async_trait]
impl OcrEngine for StubEngine {
fn name(&self) -> &'static str {
"stub"
}
fn supported_languages(&self) -> &'static [&'static str] {
&STUB_LANGUAGES
}
fn is_available(&self) -> bool {
false
}
async fn ocr_image(&self, _image_bytes: &[u8]) -> Result<OcrResult, OcrError> {
Err(OcrError::NotAvailable(
"stub".to_string(),
"OCR is not available on this platform. \
Use `nab models fetch paddle-ocr` in Phase 3 for cross-platform OCR support."
.to_string(),
))
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn stub_name_is_stub() {
assert_eq!(StubEngine.name(), "stub");
}
#[test]
fn stub_is_not_available() {
assert!(!StubEngine.is_available());
}
#[test]
fn stub_supports_no_languages() {
assert!(StubEngine.supported_languages().is_empty());
}
}