define_task!() { /* proc-macro */ }Expand description
Generates async-mpc task implementations with automatic dependency management.
This macro takes a struct definition and a compute function, and generates:
- An internal unresolved struct to hold task dependencies
- A public type alias using the
TaskWrappertype - A Task trait implementation with async execution logic
- A
newconstructor for creating new task instances - A standalone
computemethod for direct calls
ยงExamples
define_task! {
pub struct FieldAddTask<F: FieldExtension> {
x: Arc<dyn Task<Output = Arc<FieldShare<F>>>>,
y: Arc<dyn Task<Output = Arc<FieldShare<F>>>>,
}
async fn compute(x: FieldShare<F>, y: FieldShare<F>) -> Result<FieldShare<F>, AbortError> {
Ok(x + &y)
}
}