Skip to main content

TaskDefinition

Trait TaskDefinition 

Source
pub trait TaskDefinition:
    Send
    + Sync
    + Clone
    + Debug
    + 'static {
    const TASK_NAME: &'static str;
    const TASK_DOC: &'static str;

    // Required method
    fn empty() -> Self;
}
Expand description

Trait for compile-time task registration.

Implemented by each task’s output type to provide metadata for enum generation and dynamic dispatch. The trait constants are used by the define_task_system! macro to generate documentation and helper methods.

§Example

use oar_ocr_core::core::traits::TaskDefinition;

#[derive(Debug, Clone)]
pub struct MyTaskOutput {
    pub results: Vec<String>,
}

impl TaskDefinition for MyTaskOutput {
    const TASK_NAME: &'static str = "my_task";
    const TASK_DOC: &'static str = "My custom task for processing data";

    fn empty() -> Self {
        Self { results: Vec::new() }
    }
}

Required Associated Constants§

Source

const TASK_NAME: &'static str

Snake_case name for the task (e.g., “text_detection”).

Used by TaskType::name() to return a human-readable identifier.

Source

const TASK_DOC: &'static str

Human-readable documentation for the task.

Used to generate doc comments on enum variants.

Required Methods§

Source

fn empty() -> Self

Creates an empty output instance.

Used for default values, testing, and by DynTaskOutput::empty_for().

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§

Source§

impl TaskDefinition for DocumentOrientationOutput

Source§

const TASK_NAME: &'static str = "document_orientation"

Source§

const TASK_DOC: &'static str = "Document orientation classification"

Source§

impl TaskDefinition for DocumentRectificationOutput

Source§

const TASK_NAME: &'static str = "document_rectification"

Source§

const TASK_DOC: &'static str = "Document rectification/unwarp"

Source§

impl TaskDefinition for FormulaRecognitionOutput

Source§

const TASK_NAME: &'static str = "formula_recognition"

Source§

const TASK_DOC: &'static str = "Formula recognition - converting mathematical formulas to LaTeX"

Source§

impl TaskDefinition for LayoutDetectionOutput

Source§

const TASK_NAME: &'static str = "layout_detection"

Source§

const TASK_DOC: &'static str = "Layout detection/analysis"

Source§

impl TaskDefinition for SealTextDetectionOutput

Source§

const TASK_NAME: &'static str = "seal_text_detection"

Source§

const TASK_DOC: &'static str = "Seal text detection - locating text regions in seal/stamp images"

Source§

impl TaskDefinition for TableCellDetectionOutput

Source§

const TASK_NAME: &'static str = "table_cell_detection"

Source§

const TASK_DOC: &'static str = "Table cell detection - locating cells within table regions"

Source§

impl TaskDefinition for TableClassificationOutput

Source§

const TASK_NAME: &'static str = "table_classification"

Source§

const TASK_DOC: &'static str = "Table classification - classifying table images as wired or wireless"

Source§

impl TaskDefinition for TableStructureRecognitionOutput

Source§

const TASK_NAME: &'static str = "table_structure_recognition"

Source§

const TASK_DOC: &'static str = "Table structure recognition - recognizing table structure as HTML with bboxes"

Source§

impl TaskDefinition for TextDetectionOutput

Source§

const TASK_NAME: &'static str = "text_detection"

Source§

const TASK_DOC: &'static str = "Text detection - locating text regions in images"

Source§

impl TaskDefinition for TextLineOrientationOutput

Source§

const TASK_NAME: &'static str = "text_line_orientation"

Source§

const TASK_DOC: &'static str = "Text line orientation classification"

Source§

impl TaskDefinition for TextRecognitionOutput

Source§

const TASK_NAME: &'static str = "text_recognition"

Source§

const TASK_DOC: &'static str = "Text recognition - converting text regions to strings"