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 feed the task registry macros that 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§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".