Skip to main content

task_registry

Macro task_registry 

Source
macro_rules! task_registry {
    (
        $(#[$meta:meta])*
        $vis:vis mod $module:ident {
            state: $state:ty;
            task: $task:ty;
            config: $config:ty;
            context: $context:ty;
            error: $error:ty;
            kind: $kind:ty;
            lane: $lane:ty;
            payload: $payload:ty;
            result: $result:ty;
            specs {
                $(
                    $adapter:ident: $spec:ty => $kind_value:path
                ),+ $(,)?
            }
            lanes {
                $(
                    $lane_value:path => [$($lane_kind:path),* $(,)?]
                ),+ $(,)?
            }
        }
    ) => { ... };
}
Expand description

Generates a product-local static task registry.

The macro intentionally requires an explicit kind => static_adapter mapping. That keeps task registration auditable in product crates while removing the repetitive match forwarding that otherwise drifts between spec_for_kind, task_lane, and task_lane_kinds.