pub trait CrackleTask {
type Output;
// Required method
fn fire(&self) -> TaskOutput<Self::Output>;
// Provided methods
fn cool(
&self,
_output: &TaskOutput<Self::Output>,
_all_metrics: &[(String, Vec<(String, f64)>)],
) -> Vec<(String, f64)> { ... }
fn label(&self) -> String { ... }
}Expand description
The core trait for tasks in the crackle runtime.
Every task has two phases:
- Firing (
fire): Hot execution. Do the work. Produce output. - Cooling (
cool): Post-completion reflection. Examine what happened across all completed tasks and contribute observations.
The crackle glaze forms in the cooling, not the firing. Beauty arrives in the descent.
Required Associated Types§
Required Methods§
Sourcefn fire(&self) -> TaskOutput<Self::Output>
fn fire(&self) -> TaskOutput<Self::Output>
Execute the task (the hot phase).
This is where the primary work happens. Return the output along with named metrics that pattern detectors can analyze during cooling.
Provided Methods§
Sourcefn cool(
&self,
_output: &TaskOutput<Self::Output>,
_all_metrics: &[(String, Vec<(String, f64)>)],
) -> Vec<(String, f64)>
fn cool( &self, _output: &TaskOutput<Self::Output>, _all_metrics: &[(String, Vec<(String, f64)>)], ) -> Vec<(String, f64)>
Reflect on the task during cooling (optional).
Receive the output from firing and a snapshot of all completed task metrics. Return any additional observations or modified metrics.
The default implementation does nothing — many tasks don’t need to participate actively in cooling. The runtime detects patterns regardless.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".