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§
Required Methods§
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.